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: Re: `isearch-allow-scroll' - a misnomer and a bad design Date: Sun, 11 Sep 2011 17:30:12 +0000 Message-ID: <20110911173012.GA3088@acm.acm> References: <20110909215255.GD2733@acm.acm> <7002A9DA9A804F0B9F6F251FD3A2B263@us.oracle.com> <20110911103940.GA3246@acm.acm> <3C4B7E318EB04AE4B7DB9FD0E4C67629@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1315762458 18962 80.91.229.12 (11 Sep 2011 17:34:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2011 17:34:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 11 19:34:13 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2nv2-0007cf-BB for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2011 19:34:12 +0200 Original-Received: from localhost ([::1]:56335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nv1-0008My-O9 for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2011 13:34:11 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nuy-0008Kx-CR for emacs-devel@gnu.org; Sun, 11 Sep 2011 13:34:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2nuu-0001pg-Ny for emacs-devel@gnu.org; Sun, 11 Sep 2011 13:34:08 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:62214 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nut-0001lB-J9 for emacs-devel@gnu.org; Sun, 11 Sep 2011 13:34:03 -0400 Original-Received: (qmail 95491 invoked by uid 3782); 11 Sep 2011 17:34:00 -0000 Original-Received: from acm.muc.de (pD9556CD5.dip.t-dialin.net [217.85.108.213]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 11 Sep 2011 19:33:58 +0200 Original-Received: (qmail 3252 invoked by uid 1000); 11 Sep 2011 17:30:12 -0000 Content-Disposition: inline In-Reply-To: <3C4B7E318EB04AE4B7DB9FD0E4C67629@us.oracle.com> 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: Genre and OS details not recognized. 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:143893 Archived-At: Hi, Drew. On Sun, Sep 11, 2011 at 09:54:17AM -0700, Drew Adams wrote: > > > I would like to see `C-u' passed through - that's the main point. > > > Either systematically or optionally, but if optionally then > > > separately from allowing scrolling. > > Here's a better patch. I've tested it more than the previous attempt. > Thank you, Alan. Seems to work. Great stuff! > Even works with a sequence such as `C-1 C-- C-2', which passes -12 as it should, > but which is relatively unknown. I tested this case because I noticed that you > did not include `universal-argument-minus' in your test. But that is covered OK > anyway, I guess because of the default ([t]) binding for > `universal-argument-other-key'. `univeral-argument-minus' isn't used anymore. The C-- is now handled by `negative-argument'. > Can this patch please be installed? Or are there people who prefer that `C-u' > exit Isearch? If there are, then can we please have a user option for this > choice? Here's another version of the patch, this time with `isearch-allow-prefix'. Its doc string isn't all that great; perhaps you can improve it. As for installing it, it's fine by me, but you'd have to negotiate with Stefan, since we're in feature freeze. Before installing, there really ought to be a mention of the feature in the Emacs manual. As a matter of interest, the code does assume scrolling, sort of. After a "scrolling command" the code checks that the search string is within the window, and scrolls it back in if it isn't. > Thx. *** isearch.el 2011-09-04 15:31:05.000000000 +0000 --- isearch.100911.el 2011-09-11 17:14:27.000000000 +0000 *************** *** 1817,1822 **** --- 1817,1830 ---- :type 'boolean :group 'isearch) + (defcustom isearch-allow-prefix nil + "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, *************** *** 1966,1976 **** (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 --- 1974,1991 ---- (apply 'isearch-unread keylist) (isearch-edit-string)) ;; Handle a scrolling function. ! ((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).