From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: should search ring contain duplicates? Date: Wed, 03 May 2006 15:53:39 +0200 Message-ID: References: <200605030727.k437R2Wx009975@amrm2.ics.uci.edu> <87bqufwbls.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1146664557 723 80.91.229.2 (3 May 2006 13:55:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 May 2006 13:55:57 +0000 (UTC) Cc: dann@ics.uci.edu, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 03 15:55:51 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FbHpN-0003Bt-2d for ged-emacs-devel@m.gmane.org; Wed, 03 May 2006 15:55:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FbHpM-0002MZ-Nz for ged-emacs-devel@m.gmane.org; Wed, 03 May 2006 09:55:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FbHpA-0002Lh-1B for emacs-devel@gnu.org; Wed, 03 May 2006 09:55:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FbHp9-0002LM-7d for emacs-devel@gnu.org; Wed, 03 May 2006 09:55:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FbHp9-0002L3-2W for emacs-devel@gnu.org; Wed, 03 May 2006 09:55:27 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FbHpX-0000PU-6F for emacs-devel@gnu.org; Wed, 03 May 2006 09:55:51 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepa.post.tele.dk (Postfix) with SMTP id 0BD28FAC04A; Wed, 3 May 2006 15:55:23 +0200 (CEST) Original-To: Juri Linkov In-Reply-To: <87bqufwbls.fsf@jurta.org> (Juri Linkov's message of "Wed, 03 May 2006 15:48:48 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53846 Archived-At: Juri Linkov writes: > Since query-replace is the only place in Emacs that uses this new argument, > it is better to remove it now before the release, and to use a new > macro `history-push' in `query-replace-read-to' to treat the query-replace > history specially. Agree. > Below is a tested patch that removes `keep-all' from `read-from-minibuffer', > adds duplicate replacement strings to the query-replace history explicitly, > and fixes more places where the value of `history-delete-duplicates' > is not taken into account yet Looks good to me! > (namely, `repeat-complex-command', > `call-interactively', and `isearch-update-ring'). This patch doesn't use > a new macro `history-push', but it would be easy to add it later to two > places in `isearch-update-ring' and `query-replace-read-to'. I definitely think we need the history-push macro! Here is something which works for me: (defmacro history-push (newelt history &optional maxelt) "Add NEWELT to the history list stored in the symbol HISTORY. Truncate the history to max MAXELT elements, if specified, or to the value of the `history-length' property on symbol HISTORY, if set, or to the value of the `history-length' variable. Remove duplicates of NEWELT unless `history-delete-duplicates' is nil." (declare (debug (form sexp))) `(let ((len ,maxelt)) (if history-delete-duplicates (setq ,history (delete ,newelt ,history))) (setq ,history (cons ,newelt ,history)) (if (null len) (setq len (or (get ',history 'history-length) history-length))) (if (integerp len) (if (= 0 len) (setq ,history nil) (if (> (length ,history) len) (setcdr (nthcdr (1- len) ,history) nil)))))) -- Kim F. Storm http://www.cua.dk