aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2009-08-27 14:56:17 +0000
committerSam Steingold2009-08-27 14:56:17 +0000
commitba83a64e18f8472176468255eb89a4bb55c726ae (patch)
tree9a93494e08bd1e4dbf6d3e4247759e59fb2689b7
parentd5b5c94a110dd1254b6598c83d18c6691888dda0 (diff)
downloademacs-ba83a64e18f8472176468255eb89a4bb55c726ae.tar.gz
emacs-ba83a64e18f8472176468255eb89a4bb55c726ae.zip
(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.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/simple.el9
2 files changed, 15 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 32ca7ac6f46..a8ff996bbe7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-08-27 Sam Steingold <sds@gnu.org>
2
3 * simple.el (kill-do-not-save-duplicates): New user option.
4 (kill-new): When it is non-nil, and the new string is the same as
5 the latest kill, set replace to t to avoid duplicates in kill-ring.
6
12009-08-19 Julian Scheid <julians37@gmail.com> (tiny change) 72009-08-19 Julian Scheid <julians37@gmail.com> (tiny change)
2 8
3 * net/tramp.el (tramp-handle-process-file): Do not flush all 9 * net/tramp.el (tramp-handle-process-file): Do not flush all
diff --git a/lisp/simple.el b/lisp/simple.el
index 88cc61a835b..f2926401213 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2805,6 +2805,12 @@ before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]."
2805 :group 'killing 2805 :group 'killing
2806 :version "23.2") 2806 :version "23.2")
2807 2807
2808(defcustom kill-do-not-save-duplicates nil
2809 "Do not add a new string to `kill-ring' when it is the same as the last one."
2810 :type 'boolean
2811 :group 'killing
2812 :version "23.2")
2813
2808(defun kill-new (string &optional replace yank-handler) 2814(defun kill-new (string &optional replace yank-handler)
2809 "Make STRING the latest kill in the kill ring. 2815 "Make STRING the latest kill in the kill ring.
2810Set `kill-ring-yank-pointer' to point to it. 2816Set `kill-ring-yank-pointer' to point to it.
@@ -2832,6 +2838,9 @@ argument should still be a \"useful\" string for such uses."
2832 (if yank-handler 2838 (if yank-handler
2833 (signal 'args-out-of-range 2839 (signal 'args-out-of-range
2834 (list string "yank-handler specified for empty string")))) 2840 (list string "yank-handler specified for empty string"))))
2841 (when (and kill-do-not-save-duplicates
2842 (equal string (car kill-ring)))
2843 (setq replace t))
2835 (if (fboundp 'menu-bar-update-yank-menu) 2844 (if (fboundp 'menu-bar-update-yank-menu)
2836 (menu-bar-update-yank-menu string (and replace (car kill-ring)))) 2845 (menu-bar-update-yank-menu string (and replace (car kill-ring))))
2837 (when save-interprogram-paste-before-kill 2846 (when save-interprogram-paste-before-kill