bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52543: Add option to eliminate all duplications from the kill ring


From: Juri Linkov
Subject: bug#52543: Add option to eliminate all duplications from the kill ring
Date: Sun, 19 Dec 2021 21:44:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>> 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)))

Sorry, this was wrong.  It should delete all previous strings,
and add a new to the top of the kill-ring:

  (setq kill-transform-function (lambda (s) (setq kill-ring (delete s 
kill-ring)) s))

But it would be strange to modify kill-ring in the transform function.
So maybe kill-do-not-save-duplicates should support a special choice
'delete-duplicates' after all.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]