From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52543: Add option to eliminate all duplications from the kill ring Date: Sun, 19 Dec 2021 20:05:00 +0200 Organization: LINKOV.NET Message-ID: <86mtkweaib.fsf@mail.linkov.net> References: <87zgowu7fp.fsf@gnus.org> <86pmpskb6q.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10449"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: ndame , 52543@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 19 19:09:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mz0cc-0002Wp-JV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 19:09:22 +0100 Original-Received: from localhost ([::1]:41836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mz0ca-0001WI-P0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 13:09:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz0cI-0001TM-9b for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mz0cH-0004z3-W5 for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mz0cH-0002DB-Qp for bug-gnu-emacs@gnu.org; Sun, 19 Dec 2021 13:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Dec 2021 18:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52543 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 52543-submit@debbugs.gnu.org id=B52543.16399373318484 (code B ref 52543); Sun, 19 Dec 2021 18:09:01 +0000 Original-Received: (at 52543) by debbugs.gnu.org; 19 Dec 2021 18:08:51 +0000 Original-Received: from localhost ([127.0.0.1]:48080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz0c6-0002Cm-OS for submit@debbugs.gnu.org; Sun, 19 Dec 2021 13:08:50 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:52319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mz0c4-0002CV-4d for 52543@debbugs.gnu.org; Sun, 19 Dec 2021 13:08:49 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 9FEF2E0005; Sun, 19 Dec 2021 18:08:40 +0000 (UTC) In-Reply-To: <86pmpskb6q.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 19 Dec 2021 19:03:49 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222734 Archived-At: >>> 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") --