[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query-replace in isearch (was Re: should search ring contain duplica
From: |
Juri Linkov |
Subject: |
Re: query-replace in isearch (was Re: should search ring contain duplicates?) |
Date: |
Tue, 30 May 2006 12:28:56 +0300 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
> 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/
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), (continued)
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Kim F. Storm, 2006/05/11
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/11
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/18
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Kim F. Storm, 2006/05/20
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/21
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/20
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/23
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/23
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/25
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/29
- Re: query-replace in isearch (was Re: should search ring contain duplicates?),
Juri Linkov <=
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/30
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/12
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Juri Linkov, 2006/05/12
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/13
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Kim F. Storm, 2006/05/13
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Richard Stallman, 2006/05/14
- Re: query-replace in isearch (was Re: should search ring contain duplicates?), Kim F. Storm, 2006/05/14
- Re: should search ring contain duplicates?, Juri Linkov, 2006/05/09
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/10
- Re: should search ring contain duplicates?, Juri Linkov, 2006/05/10