GNU bug report logs - #52543
Add option to eliminate all duplications from the kill ring

Previous Next

Package: emacs;

Reported by: ndame <laszlomail <at> protonmail.com>

Date: Thu, 16 Dec 2021 09:50:02 UTC

Severity: normal

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: ndame <laszlomail <at> protonmail.com>, 52543 <at> debbugs.gnu.org
Subject: bug#52543: Add option to eliminate all duplications from the kill ring
Date: Sun, 19 Dec 2021 20:05:00 +0200
>>> There isĀ  kill-do-not-save-duplicates, but it deletes
>>> only subsequent duplicates.
>>>
>>> There should be an other variable which prevents any duplicates
>>> even if there are, say,  10 or 20 items between them.
>>>
>>> I expected kill-do-not-save-duplicates to do that, that variable
>>> seems misnamed. It should be kill-do-not-save-subsequent-duplicates
>>> instead.
>>
>> This has previously been discussed, and we decided to not alter how this
>> works, because it'd be too surprising.  (And there are options to filter
>> the kill ring that users that want that can use.)  So I'm closing this
>> bug report.
>
> Indeed:
>
>   (setq kill-transform-function (lambda (s) (unless (member s kill-ring) s)))

Here is the same as a choice to make it easier for everyone
to satisfy this frequent need - like history-delete-duplicates
and comint-input-ignoredups in Emacs, and ignoredups in shell.
If this is ok, more documentation could be added:

diff --git a/lisp/simple.el b/lisp/simple.el
index 959e7ea94c..466bc9c12d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5118,6 +5118,8 @@ kill-transform-function
 be put on the kill ring).  It should return a string or nil.  If
 the latter, the string is not put on the kill ring."
   :type '(choice (const :tag "No transform" nil)
+                 (const :tag "Ignore duplicates"
+                        (lambda (s) (unless (member s kill-ring) s)))
                  function)
   :group 'killing
   :version "28.1")
-- 




This bug report was last modified 3 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.