all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: dann@ics.uci.edu, emacs-devel@gnu.org, storm@cua.dk
Subject: Re: query-replace in isearch (was Re: should search ring contain duplicates?)
Date: Tue, 30 May 2006 12:28:56 +0300	[thread overview]
Message-ID: <8764jnuahz.fsf@jurta.org> (raw)
In-Reply-To: <E1FkbPF-00032n-G2@fencepost.gnu.org> (Richard Stallman's message of "Mon, 29 May 2006 02:39:13 -0400")

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

  reply	other threads:[~2006-05-30  9:28 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03  0:54 should search ring contain duplicates? Drew Adams
2006-05-03  7:27 ` Dan Nicolaescu
2006-05-03  8:26   ` Kim F. Storm
2006-05-03 12:48     ` Juri Linkov
2006-05-03 13:53       ` Kim F. Storm
2006-05-04 10:12         ` Kim F. Storm
2006-05-04 10:29           ` David Kastrup
2006-05-04 12:00             ` Stefan Monnier
2006-05-04 12:19             ` Kim F. Storm
2006-05-04 12:25               ` David Kastrup
2006-05-05 22:14               ` Richard Stallman
2006-05-05 23:55                 ` Kim F. Storm
2006-05-06  8:00                   ` Eli Zaretskii
2006-05-06 23:36                     ` Richard Stallman
2006-05-07 20:41                       ` Kim F. Storm
2006-05-04 16:05             ` Stuart D. Herring
2006-05-04 16:23               ` David Kastrup
2006-05-04 16:36                 ` Stuart D. Herring
2006-05-04 21:55               ` Kim F. Storm
2006-05-03 15:04       ` query-replace in isearch (was Re: should search ring contain duplicates?) Dan Nicolaescu
2006-05-03 20:27         ` query-replace in isearch Juri Linkov
2006-05-03 20:43         ` query-replace in isearch (was Re: should search ring contain duplicates?) Richard Stallman
2006-05-11  3:45         ` Richard Stallman
2006-05-11 11:57           ` Juri Linkov
2006-05-11 14:10             ` Kim F. Storm
2006-05-11 21:52               ` Juri Linkov
2006-05-19  3:05                 ` Juri Linkov
2006-05-20 22:39                   ` Kim F. Storm
2006-05-21  4:27                     ` Juri Linkov
2006-05-21  0:55                   ` Richard Stallman
2006-05-23  5:17                     ` Juri Linkov
2006-05-24  2:18                       ` Richard Stallman
2006-05-25 22:47                         ` Juri Linkov
2006-05-29  6:39                           ` Richard Stallman
2006-05-30  9:28                             ` Juri Linkov [this message]
2006-05-31  0:40                               ` Richard Stallman
2006-05-12  4:15             ` Richard Stallman
2006-05-12 11:14               ` Juri Linkov
2006-05-13  4:52                 ` Richard Stallman
2006-05-13 23:13                   ` Kim F. Storm
2006-05-14 15:09                     ` Richard Stallman
2006-05-14 20:52                       ` Kim F. Storm
2006-05-09 20:47       ` should search ring contain duplicates? Juri Linkov
2006-05-10  9:34         ` Kim F. Storm
2006-05-10 22:55           ` Juri Linkov
2006-05-11 10:08             ` Kim F. Storm
2006-05-14 23:29             ` Richard Stallman
2006-05-15  9:54               ` Kim F. Storm
2006-05-16  4:29                 ` Richard Stallman
2006-05-16 11:07                   ` Kim F. Storm
2006-05-11 11:59       ` C-f in isearch minibuffer (was: should search ring contain duplicates?) Juri Linkov
2006-05-11 14:04         ` C-f in isearch minibuffer Miles Bader
2006-05-11 21:52           ` Juri Linkov
2006-05-12  4:15         ` C-f in isearch minibuffer (was: should search ring contain duplicates?) Richard Stallman
2006-05-12 11:12           ` C-f in isearch minibuffer Juri Linkov
2006-05-13  4:52             ` Richard Stallman
2006-05-03 14:18   ` should search ring contain duplicates? Stefan Monnier
2006-05-03 14:25     ` Kim F. Storm
2006-05-03 14:40     ` Drew Adams
2006-05-03 15:54       ` Drew Adams
2006-05-03 20:27         ` Juri Linkov
2006-05-03 23:08           ` Drew Adams
2006-05-04 14:17         ` Richard Stallman
2006-05-04 15:07           ` Kim F. Storm
2006-05-04 22:44             ` Kim F. Storm
2006-05-05 19:05             ` Richard Stallman
2006-05-05 19:14               ` Drew Adams
2006-05-05 19:25                 ` David Kastrup
2006-05-05 20:09                   ` Drew Adams
2006-05-06 14:25                   ` Richard Stallman
2006-05-05 23:22                 ` Juri Linkov
2006-05-05 23:32                   ` Kim F. Storm
2006-05-06  2:05                   ` Drew Adams
2006-05-03 14:43     ` Dan Nicolaescu
2006-05-04 19:41     ` Richard Stallman
2006-05-03 20:42   ` Richard Stallman
2006-05-03 22:41     ` Dan Nicolaescu
2006-05-04 19:41       ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764jnuahz.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.