diff options
author | Leo Liu <sdl.web@gmail.com> | 2012-03-13 02:21:35 +0800 |
---|---|---|
committer | Leo Liu <sdl.web@gmail.com> | 2012-03-13 02:21:35 +0800 |
commit | e2f1fdab9105065bda0212bf1558eca186c2f3cb (patch) | |
tree | c61eae35d42a4ac23af8a9ba5406d39da91dbbb4 /lisp/simple.el | |
parent | b19490edc32e6c423f8b18174aba41a513bbe1eb (diff) | |
download | emacs-e2f1fdab9105065bda0212bf1558eca186c2f3cb.tar.gz |
* lisp/simple.el (kill-new): Use equal-including-properties for
comparison.
(kill-do-not-save-duplicates): Doc fix.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index f42ea3e7a50..936037f5caa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3069,7 +3069,8 @@ before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]." :version "23.2") (defcustom kill-do-not-save-duplicates nil - "Do not add a new string to `kill-ring' when it is the same as the last one." + "Do not add a new string to `kill-ring' if it duplicates the last one. +The comparison is done using `equal-including-properties'." :type 'boolean :group 'killing :version "23.2") @@ -3097,7 +3098,10 @@ argument should still be a \"useful\" string for such uses." (signal 'args-out-of-range (list string "yank-handler specified for empty string")))) (unless (and kill-do-not-save-duplicates - (equal string (car kill-ring))) + ;; Due to text properties such as 'yank-handler that + ;; can alter the contents to yank, comparison using + ;; `equal' is unsafe. + (equal-including-properties 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 @@ -3108,10 +3112,10 @@ argument should still be a \"useful\" string for such uses." (nreverse interprogram-paste) (list interprogram-paste))) (unless (and kill-do-not-save-duplicates - (equal s (car kill-ring))) + (equal-including-properties s (car kill-ring))) (push s kill-ring)))))) (unless (and kill-do-not-save-duplicates - (equal string (car kill-ring))) + (equal-including-properties string (car kill-ring))) (if (and replace kill-ring) (setcar kill-ring string) (push string kill-ring) |