Commit ba83a64e authored by Sam Steingold's avatar Sam Steingold
Browse files

(kill-do-not-save-duplicates): New user option.

(kill-new): When it is non-nil, and the new string is the same as
the latest kill, set replace to t to avoid duplicates in kill-ring.
parent d5b5c94a
2009-08-27 Sam Steingold <sds@gnu.org>
* simple.el (kill-do-not-save-duplicates): New user option.
(kill-new): When it is non-nil, and the new string is the same as
the latest kill, set replace to t to avoid duplicates in kill-ring.
2009-08-19 Julian Scheid <julians37@gmail.com> (tiny change) 2009-08-19 Julian Scheid <julians37@gmail.com> (tiny change)
* net/tramp.el (tramp-handle-process-file): Do not flush all * net/tramp.el (tramp-handle-process-file): Do not flush all
......
...@@ -2805,6 +2805,12 @@ before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]." ...@@ -2805,6 +2805,12 @@ before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]."
:group 'killing :group 'killing
:version "23.2") :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."
:type 'boolean
:group 'killing
:version "23.2")
(defun kill-new (string &optional replace yank-handler) (defun kill-new (string &optional replace yank-handler)
"Make STRING the latest kill in the kill ring. "Make STRING the latest kill in the kill ring.
Set `kill-ring-yank-pointer' to point to it. Set `kill-ring-yank-pointer' to point to it.
...@@ -2832,6 +2838,9 @@ argument should still be a \"useful\" string for such uses." ...@@ -2832,6 +2838,9 @@ argument should still be a \"useful\" string for such uses."
(if yank-handler (if yank-handler
(signal 'args-out-of-range (signal 'args-out-of-range
(list string "yank-handler specified for empty string")))) (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) (if (fboundp 'menu-bar-update-yank-menu)
(menu-bar-update-yank-menu string (and replace (car kill-ring)))) (menu-bar-update-yank-menu string (and replace (car kill-ring))))
(when save-interprogram-paste-before-kill (when save-interprogram-paste-before-kill
......
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