From 80fa505f891b420e27f56746d41f51aa5b9d7d51 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 5 Jun 2013 20:57:09 +0000 Subject: [PATCH] * isearch.el (isearch-allow-prefix): New user option. (isearch-other-meta-char): don't exit isearch when a prefix argument is typed whilst `isearch-allow-prefix' is non-nil. * search.texi (Isearch Scroll): Rename to "Not Exiting Isearch". (Net Exiting Isearch): Document new user option `isearch-allow-prefix'. * etc/NEWS. Entry for this change. --- doc/emacs/ChangeLog | 6 ++++++ doc/emacs/emacs.texi | 16 ++++++++-------- doc/emacs/search.texi | 40 ++++++++++++++++++++++++++++++---------- etc/NEWS | 4 ++++ lisp/ChangeLog | 6 ++++++ lisp/isearch.el | 27 +++++++++++++++++++++------ 6 files changed, 75 insertions(+), 24 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index a700f225a79..f384a0639d8 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,9 @@ +2013-06-05 Alan Mackenzie + + * search.texi (Isearch Scroll): Rename to "Not Exiting Isearch". + (Net Exiting Isearch): Document new user option + `isearch-allow-prefix'. + 2013-06-03 Juri Linkov * display.texi (Highlight Interactively): Add global keybindings diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index d2ec2154024..e2d0b0eebf6 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -396,14 +396,14 @@ Searching and Replacement Incremental Search -* Basic Isearch:: Basic incremental search commands. -* Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. -* Isearch Yank:: Commands that grab text into the search string - or else edit the search string. -* Isearch Scroll:: Scrolling during an incremental search. -* Isearch Minibuffer:: Incremental search of the minibuffer history. +* Basic Isearch:: Basic incremental search commands. +* Repeat Isearch:: Searching for the same string again. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. +* Isearch Yank:: Commands that grab text into the search string + or else edit the search string. +* Not Exiting Isearch:: Prefix argument and scrolling commands. +* Isearch Minibuffer:: Incremental search of the minibuffer history. Replacement Commands diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index e146177255e..ead7c3cbf16 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -52,14 +52,14 @@ Incremental search backward (@code{isearch-backward}). @end table @menu -* Basic Isearch:: Basic incremental search commands. -* Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. -* Isearch Yank:: Commands that grab text into the search string - or else edit the search string. -* Isearch Scroll:: Scrolling during an incremental search. -* Isearch Minibuffer:: Incremental search of the minibuffer history. +* Basic Isearch:: Basic incremental search commands. +* Repeat Isearch:: Searching for the same string again. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. +* Isearch Yank:: Commands that grab text into the search string + or else edit the search string. +* Not Exiting Isearch:: Prefix argument and scrolling commands. +* Isearch Minibuffer:: Incremental search of the minibuffer history. @end menu @node Basic Isearch @@ -332,9 +332,28 @@ alternative method to add the character after point is to enter the minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f} at the end of the search string in the minibuffer. -@node Isearch Scroll -@subsection Scrolling During Incremental Search +@node Not Exiting Isearch +@subsection Not Exiting Incremental Search +This subsection describes two categories of commands which you can +type without exiting the current incremental search, even though they +are not themselves part of incremental search. + +@table @asis +@item Prefix Arguments +@vindex isearch-allow-prefix + In incremental search, when you enter a prefix argument +(@pxref{Arguments}), by default it will apply either to the next +action in the search or to the command that exits the search. + + In previous versions of Emacs, entering a prefix argument always +terminated the search. You can revert to this behavior by setting the +variable @code{isearch-allow-prefix} to @code{nil}. + + When @code{isearch-allow-scroll} is non-@code{nil} (see below), +prefix arguments always have the default behavior described above. + +@item Scrolling Commands @vindex isearch-allow-scroll Normally, scrolling commands exit incremental search. If you change the variable @code{isearch-allow-scroll} to a non-@code{nil} value, @@ -366,6 +385,7 @@ This feature can be applied to any command that doesn't permanently change point, the buffer contents, the match data, the current buffer, or the selected window and frame. The command must not itself attempt an incremental search. +@end table @node Isearch Minibuffer @subsection Searching the Minibuffer diff --git a/etc/NEWS b/etc/NEWS index 0b533efe163..8732ffa2fcd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -292,6 +292,10 @@ when it's nil). *** `query-replace' skips invisible text when `search-invisible' is nil, and opens overlays with hidden text when `search-invisible' is `open'. ++++ +*** By default, prefix arguments do not now terminate Isearch mode. +Set `isearch-allow-prefix' to nil to restore old behavior. + ** MH-E has been updated to MH-E version 8.5. See MH-E-NEWS for details. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7de7b079570..f40a23a5035 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-06-05 Alan Mackenzie + + * isearch.el (isearch-allow-prefix): New user option. + (isearch-other-meta-char): don't exit isearch when a prefix + argument is typed whilst `isearch-allow-prefix' is non-nil. + 2013-06-05 Stefan Monnier * autorevert.el (auto-revert-notify-handler): Use memq. diff --git a/lisp/isearch.el b/lisp/isearch.el index c49b0d7fc59..e6678d33ea4 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2152,6 +2152,14 @@ If nil, scrolling commands will first cancel Isearch mode." :type 'boolean :group 'isearch) +(defcustom isearch-allow-prefix t + "Whether prefix arguments are allowed during incremental search. +If non-nil, entering a prefix argument will not terminate the +search. This option is ignored \(presumed t) when +`isearch-allow-scroll' is set." + :type 'boolean + :group 'isearch) + (defun isearch-string-out-of-window (isearch-point) "Test whether the search string is currently outside of the window. Return nil if it's completely visible, or if point is visible, @@ -2304,12 +2312,19 @@ Isearch mode." (setq prefix-arg arg) (apply 'isearch-unread keylist) (isearch-edit-string)) - ;; Handle a scrolling function. - ((and isearch-allow-scroll - (progn (setq key (isearch-reread-key-sequence-naturally keylist)) - (setq keylist (listify-key-sequence key)) - (setq main-event (aref key 0)) - (setq scroll-command (isearch-lookup-scroll-key key)))) + ;; Handle a scrolling function or prefix argument. + ((progn + (setq key (isearch-reread-key-sequence-naturally keylist) + keylist (listify-key-sequence key) + main-event (aref key 0)) + (or (and isearch-allow-scroll + (setq scroll-command (isearch-lookup-scroll-key key))) + (and isearch-allow-prefix + (let (overriding-terminal-local-map) + (setq scroll-command (key-binding key)) + (memq scroll-command + '(universal-argument + negative-argument digit-argument)))))) ;; From this point onwards, KEY, KEYLIST and MAIN-EVENT hold a ;; complete key sequence, possibly as modified by function-key-map, ;; not merely the one or two event fragment which invoked -- 2.39.2