From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: isearch-allow-prefix [Was: [PATCH] Make `C-x {' and `C-x }' repeatable] Date: Sun, 2 Jun 2013 21:05:12 +0000 Message-ID: <20130602210512.GC2765@acm.acm> References: <87txlts7so.fsf@mail.jurta.org> <20130524093858.GA2754@acm.acm> <87hahstd47.fsf@mail.jurta.org> <20130525200103.GA3451@acm.acm> <878v32aj3c.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1370207138 8293 80.91.229.3 (2 Jun 2013 21:05:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Jun 2013 21:05:38 +0000 (UTC) Cc: Drew Adams , emacs-devel@gnu.org To: Juri Linkov , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 02 23:05:37 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UjFT6-0006Vr-O3 for ged-emacs-devel@m.gmane.org; Sun, 02 Jun 2013 23:05:36 +0200 Original-Received: from localhost ([::1]:43285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjFT6-0001gC-93 for ged-emacs-devel@m.gmane.org; Sun, 02 Jun 2013 17:05:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjFT1-0001g4-9P for emacs-devel@gnu.org; Sun, 02 Jun 2013 17:05:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjFSz-0005dV-Mr for emacs-devel@gnu.org; Sun, 02 Jun 2013 17:05:31 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:41048 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjFSz-0005dQ-Cy for emacs-devel@gnu.org; Sun, 02 Jun 2013 17:05:29 -0400 Original-Received: (qmail 133 invoked by uid 3782); 2 Jun 2013 21:05:28 -0000 Original-Received: from acm.muc.de (p5492C92D.dip0.t-ipconnect.de [84.146.201.45]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 02 Jun 2013 23:05:23 +0200 Original-Received: (qmail 27059 invoked by uid 1000); 2 Jun 2013 21:05:12 -0000 Content-Disposition: inline In-Reply-To: <878v32aj3c.fsf@mail.jurta.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160010 Archived-At: Hi, Juri and Stefan. On Sat, May 25, 2013 at 11:40:55PM +0300, Juri Linkov wrote: > >> There is an unaddressed request for this feature in bug#9706. > > If I remember correctly, the patch to the code was finished and working > > (and who knows, might still work), but the patch to the manual hadn't yet > > been written. > I highly recommend enabling `isearch-allow-prefix' by default > in your patch, provided that it can correctly apply a specified > argument either to a isearch command (that doesn't exit isearch) > or to a normal command (that exits isearch). > IOW, if `C-u C-M-y' typed in isearch-mode will apply `C-u' > to `isearch-yank-char' without exiting isearch, but `C-u C-f' > will exit isearch and apply `C-u' to `forward-char', then > the default value of `isearch-allow-prefix' should be `t'. OK. Here is a patch for isearch.el, search.texi and NEWS. I'm not terribly impressed by the documentation patch, but it was the best I could manage. Do you have any comments on the patch, or should I just commit it? === modified file 'doc/emacs/emacs.texi' *** doc/emacs/emacs.texi 2013-03-30 16:47:07 +0000 --- doc/emacs/emacs.texi 2013-06-02 18:25:29 +0000 *************** *** 396,409 **** 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. Replacement Commands --- 396,410 ---- 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. ! * Prefix Argument in Isearch:: What prefix arguments do. ! * 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. Replacement Commands === modified file 'doc/emacs/search.texi' *** doc/emacs/search.texi 2013-05-15 23:14:18 +0000 --- doc/emacs/search.texi 2013-06-02 20:52:05 +0000 *************** *** 52,65 **** @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. @end menu @node Basic Isearch --- 52,66 ---- @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. ! * Prefix Argument in Isearch:: What prefix arguments do. ! * 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. @end menu @node Basic Isearch *************** *** 212,217 **** --- 213,234 ---- waiting for more input, so a second @kbd{C-g} will cancel the entire search. + @node Prefix Argument in Isearch + @subsection The Prefix Argument in Incremental Search + + @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} (@pxref{Isearch + Scroll}), prefix arguments always have the default behavior described + above. + @node Special Isearch @subsection Special Input for Incremental Search === modified file 'etc/NEWS' *** etc/NEWS 2013-05-27 23:02:37 +0000 --- etc/NEWS 2013-06-02 19:56:21 +0000 *************** *** 244,249 **** --- 244,253 ---- *** `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 can now be entered without + terminating Isearch mode. Set `isearch-allow-prefix' to nil to disable. + ** MH-E has been updated to MH-E version 8.5. See MH-E-NEWS for details. === modified file 'lisp/isearch.el' *** lisp/isearch.el 2013-05-27 22:42:11 +0000 --- lisp/isearch.el 2013-06-02 20:54:25 +0000 *************** *** 2102,2107 **** --- 2102,2115 ---- :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, *************** *** 2254,2265 **** (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)))) ;; 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 --- 2262,2280 ---- (setq prefix-arg arg) (apply 'isearch-unread keylist) (isearch-edit-string)) ! ;; 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 -- Alan Mackenzie (Nuremberg, Germany).