GNU bug report logs -
#52543
Add option to eliminate all duplications from the kill ring
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52543 in the body.
You can then email your comments to 52543 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Thu, 16 Dec 2021 09:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
ndame <laszlomail <at> protonmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 16 Dec 2021 09:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Sun, 19 Dec 2021 12:05:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52543 <at> debbugs.gnu.org (full text, mbox):
ndame <laszlomail <at> protonmail.com> writes:
> 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.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 19 Dec 2021 12:06:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
52543 <at> debbugs.gnu.org and ndame <laszlomail <at> protonmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 19 Dec 2021 12:06:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Sun, 19 Dec 2021 17:21:03 GMT)
Full text and
rfc822 format available.
Message #15 received at 52543 <at> debbugs.gnu.org (full text, mbox):
>> 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)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Sun, 19 Dec 2021 18:09:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 52543 <at> debbugs.gnu.org (full text, mbox):
>>> 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")
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Sun, 19 Dec 2021 19:46:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 52543 <at> debbugs.gnu.org (full text, mbox):
>>> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52543
; Package
emacs
.
(Tue, 21 Dec 2021 04:10:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 52543 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> 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.
I think some people wouldn't want to remove the duplicates (and add to
the front), and some wouldn't want to add at all (I think that was the
request in the other bug report?), and some want to take text properties
into account, and some don't, so I think leaving this to the user and
the transform function is the right solution. But we don't have to make
any pre-made functions for this.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 18 Jan 2022 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 152 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.