emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100531: * lisp/simple.el (kill-new):


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100531: * lisp/simple.el (kill-new): Fix logic of kill-do-not-save-duplicates.
Date: Fri, 04 Jun 2010 21:38:11 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100531
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Fri 2010-06-04 21:38:11 +0300
message:
  * lisp/simple.el (kill-new): Fix logic of kill-do-not-save-duplicates.
  Instead of setting `replace' to t and replacing the same string
  with itself, don't do certain actions when
  kill-do-not-save-duplicates is non-nil and string is equal to car
  of kill-ring: don't call menu-bar-update-yank-menu, don't push
  interprogram-paste strings to kill-ring, and don't push the input
  argument `string' to kill-ring.
  http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00072.html
modified:
  lisp/ChangeLog
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-04 14:13:35 +0000
+++ b/lisp/ChangeLog    2010-06-04 18:38:11 +0000
@@ -1,3 +1,14 @@
+2010-06-04  Juri Linkov  <address@hidden>
+
+       * simple.el (kill-new): Fix logic of kill-do-not-save-duplicates.
+       Instead of setting `replace' to t and replacing the same string
+       with itself, don't do certain actions when
+       kill-do-not-save-duplicates is non-nil and string is equal to car
+       of kill-ring: don't call menu-bar-update-yank-menu, don't push
+       interprogram-paste strings to kill-ring, and don't push the input
+       argument `string' to kill-ring.
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00072.html
+
 2010-06-04  Juanma Barranquero  <address@hidden>
 
        * subr.el (directory-sep-char): Move from fileio.c and make a defconst.

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2010-05-19 17:16:07 +0000
+++ b/lisp/simple.el    2010-06-04 18:38:11 +0000
@@ -2905,24 +2905,27 @@
     (if yank-handler
        (signal 'args-out-of-range
                (list string "yank-handler specified for empty string"))))
-  (when (and kill-do-not-save-duplicates
-             (equal string (car kill-ring)))
-    (setq replace t))
-  (if (fboundp 'menu-bar-update-yank-menu)
-      (menu-bar-update-yank-menu string (and replace (car kill-ring))))
+  (unless (and kill-do-not-save-duplicates
+              (equal string (car kill-ring)))
+    (if (fboundp 'menu-bar-update-yank-menu)
+       (menu-bar-update-yank-menu string (and replace (car kill-ring)))))
   (when save-interprogram-paste-before-kill
     (let ((interprogram-paste (and interprogram-paste-function
                                    (funcall interprogram-paste-function))))
       (when interprogram-paste
-        (if (listp interprogram-paste)
-            (dolist (s (nreverse interprogram-paste))
-              (push s kill-ring))
-            (push interprogram-paste kill-ring)))))
-  (if (and replace kill-ring)
-      (setcar kill-ring string)
-    (push string kill-ring)
-    (if (> (length kill-ring) kill-ring-max)
-       (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
+        (dolist (s (if (listp interprogram-paste)
+                      (nreverse interprogram-paste)
+                    (list interprogram-paste)))
+         (unless (and kill-do-not-save-duplicates
+                      (equal s (car kill-ring)))
+           (push s kill-ring))))))
+  (unless (and kill-do-not-save-duplicates
+              (equal string (car kill-ring)))
+    (if (and replace kill-ring)
+       (setcar kill-ring string)
+      (push string kill-ring)
+      (if (> (length kill-ring) kill-ring-max)
+         (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))))
   (setq kill-ring-yank-pointer kill-ring)
   (if interprogram-cut-function
       (funcall interprogram-cut-function string (not replace))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]