Commit e2f1fdab authored by Leo Liu's avatar Leo Liu
Browse files

* lisp/simple.el (kill-new): Use equal-including-properties for

comparison.
(kill-do-not-save-duplicates): Doc fix.
parent b19490ed
2012-03-12 Leo Liu <sdl.web@gmail.com>
* simple.el (kill-new): Use equal-including-properties for
comparison.
(kill-do-not-save-duplicates): Doc fix.
2012-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
* dabbrev.el: Fix cycle completion (bug#10963).
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment