From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: query-replace in isearch (was Re: should search ring contain duplicates?) Date: Tue, 30 May 2006 12:28:56 +0300 Organization: JURTA Message-ID: <8764jnuahz.fsf@jurta.org> References: <200605030727.k437R2Wx009975@amrm2.ics.uci.edu> <87bqufwbls.fsf@jurta.org> <200605031504.k43F49hr001544@scanner2.ics.uci.edu> <87wtcslqoj.fsf@jurta.org> <87slng8c5p.fsf@jurta.org> <87ac9ekbw6.fsf@jurta.org> <878xotibsd.fsf@jurta.org> <878xopbue3.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 1148981698 506 80.91.229.2 (30 May 2006 09:34:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 May 2006 09:34:58 +0000 (UTC) Cc: dann@ics.uci.edu, emacs-devel@gnu.org, storm@cua.dk Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 30 11:34:54 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 1Fl0cl-0003GU-RO for ged-emacs-devel@m.gmane.org; Tue, 30 May 2006 11:34:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fl0cl-0002qU-5P for ged-emacs-devel@m.gmane.org; Tue, 30 May 2006 05:34:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fl0cW-0002oj-Ik for emacs-devel@gnu.org; Tue, 30 May 2006 05:34:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fl0cT-0002nz-TZ for emacs-devel@gnu.org; Tue, 30 May 2006 05:34:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fl0cT-0002nw-Nv for emacs-devel@gnu.org; Tue, 30 May 2006 05:34:33 -0400 Original-Received: from [217.25.160.1] (helo=relay1.binet.com.ua) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fl0iB-0008Da-BI; Tue, 30 May 2006 05:40:27 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by relay1.binet.com.ua (Postfix) with ESMTP id BB70C799F0; Tue, 30 May 2006 12:34:27 +0300 (EEST) Original-Received: from mail.binet.com.ua (i24.dialup.binet.com.ua [217.25.161.88]) by relay1.binet.com.ua (Postfix) with ESMTP id 39B4E79978; Tue, 30 May 2006 12:34:23 +0300 (EEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 29 May 2006 02:39:13 -0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by ClamAv at binet.com.ua 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:55470 Archived-At: > I don't mind using a variable name that opens the room for other extensions, > but we don't need those other extensions now. So please call it > `history-add-new-input', and initially just define the values t and nil. Please see the patch below: Index: src/minibuf.c =================================================================== RCS file: /sources/emacs/emacs/src/minibuf.c,v retrieving revision 1.304 diff -c -r1.304 minibuf.c *** src/minibuf.c 25 May 2006 21:16:22 -0000 1.304 --- src/minibuf.c 30 May 2006 09:27:04 -0000 *************** *** 66,71 **** --- 66,75 ---- int history_delete_duplicates; + /* Non-nil means add new input to history. */ + + Lisp_Object Vhistory_add_new_input; + /* Fread_minibuffer leaves the input here as a string. */ Lisp_Object last_minibuf_string; *************** *** 749,759 **** else histstring = Qnil; /* Add the value to the appropriate history list, if any. */ ! if (SYMBOLP (Vminibuffer_history_variable) && !NILP (histstring)) { /* If the caller wanted to save the value read on a history list, --- 753,766 ---- else histstring = Qnil; /* Add the value to the appropriate history list, if any. */ ! if (!NILP (Vhistory_add_new_input) ! && SYMBOLP (Vminibuffer_history_variable) && !NILP (histstring)) { /* If the caller wanted to save the value read on a history list, *************** *** 2800,2808 **** If set to t when adding a new history element, all previous identical elements are deleted. */); history_delete_duplicates = 0; + DEFVAR_LISP ("history-add-new-input", &Vhistory_add_new_input, + doc: /* *Non-nil means to add new elements in history. + If set to nil, minibuffer reading functions don't add new elements to the + history list, so it is possible to do this afterwards by calling + `add-to-history' explicitly. */); + Vhistory_add_new_input = Qt; + DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, doc: /* *Non-nil means automatically provide help for invalid completion input. Under Partial Completion mode, a non-nil, non-t value has a special meaning; Index: lispref/minibuf.texi =================================================================== RCS file: /sources/emacs/emacs/lispref/minibuf.texi,v retrieving revision 1.83 diff -c -r1.83 minibuf.texi *** lispref/minibuf.texi 25 May 2006 22:57:50 -0000 1.83 --- lispref/minibuf.texi 30 May 2006 09:27:03 -0000 *************** *** 460,465 **** --- 460,471 ---- duplicates, and to add @var{newelt} to the list even if it is empty. @end defun + @defvar history-add-new-input + The value of this variable @code{nil} means that standard functions + that read from the minibuffer don't add new elements to the history + list, so it is possible to do this explicitly by using @code{add-to-history}. + @end defvar + @defvar history-length The value of this variable specifies the maximum length for all history lists that don't specify their own maximum lengths. If the Index: etc/NEWS =================================================================== RCS file: /sources/emacs/emacs/etc/NEWS,v retrieving revision 1.1349 diff -c -r1.1349 NEWS *** etc/NEWS 25 May 2006 21:53:31 -0000 1.1349 --- etc/NEWS 30 May 2006 09:27:33 -0000 *************** *** 4371,4376 **** --- 4375,4386 ---- It is like `read-file-name' except that the defaulting works better for directories, and completion inside it shows only directories. + +++ + *** The new variable `history-add-new-input' specifies whether to add new + elements in history. If set to nil, minibuffer reading functions don't + add new elements to the history list, so it is possible to do this + afterwards by calling `add-to-history' explicitly. + ** Completion changes: +++ Index: lisp/replace.el =================================================================== RCS file: /sources/emacs/emacs/lisp/replace.el,v retrieving revision 1.242 diff -c -r1.242 replace.el *** lisp/replace.el 28 May 2006 17:05:38 -0000 1.242 --- lisp/replace.el 30 May 2006 09:27:28 -0000 *************** *** 99,105 **** wants to replace FROM with TO." (if query-replace-interactive (car (if regexp-flag regexp-search-ring search-ring)) ! (let ((from ;; The save-excursion here is in case the user marks and copies ;; a region in order to specify the minibuffer input. ;; That should not clobber the region for the query-replace itself. --- 99,106 ---- wants to replace FROM with TO." (if query-replace-interactive (car (if regexp-flag regexp-search-ring search-ring)) ! (let* ((history-add-new-input nil) ! (from ;; The save-excursion here is in case the user marks and copies ;; a region in order to specify the minibuffer input. ;; That should not clobber the region for the query-replace itself. *************** *** 114,125 **** (cons (car query-replace-defaults) (query-replace-compile-replacement (cdr query-replace-defaults) regexp-flag)) + (add-to-history query-replace-from-history-variable from nil t) ;; Warn if user types \n or \t, but don't reject the input. (and regexp-flag (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) *************** *** 174,183 **** "Query and return the `to' argument of a query-replace operation." (query-replace-compile-replacement (save-excursion ! (let ((to (read-from-minibuffer ! (format "%s %s with: " prompt (query-replace-descr from)) ! nil nil nil ! query-replace-to-history-variable from t))) (setq query-replace-defaults (cons from to)) to)) regexp-flag)) --- 176,187 ---- "Query and return the `to' argument of a query-replace operation." (query-replace-compile-replacement (save-excursion ! (let* ((history-add-new-input nil) ! (to (read-from-minibuffer ! (format "%s %s with: " prompt (query-replace-descr from)) ! nil nil nil ! query-replace-to-history-variable from t))) ! (add-to-history query-replace-to-history-variable to nil t) (setq query-replace-defaults (cons from to)) to)) regexp-flag)) -- Juri Linkov http://www.jurta.org/emacs/