all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.
Date: Mon, 29 Aug 2011 21:06:59 +0000	[thread overview]
Message-ID: <20110829210659.GC2908@acm.acm> (raw)

Hi, Emacs.

Bug #8901 again, for reference:
1.   emacs -Q
2.   M-: (setq isearch-allow-scroll t)
3.   C-x C-f <any file>
4.   C-s <a few characters>
5.   C-u C-<space>

This last command ought to terminate the isearch and move point to where
the search began.  Instead, it pushes a mark, as though the C-u were not
there.

#########################################################################

DIAGNOSIS: The processing happens in `isearch-other-meta-char';
C-<space> now gets caught by the first arm of the cond.

In this cond arm, the events in the key sequence are unread, but the
prefix arg doesn't get "unread", hence gets lost.


FIX: insert a (setq prefix-arg arg) at each place where an unread
happens.

#########################################################################

Question: will adding this setq "everywhere" (rather than the one place
it is needed to fix the bug) do any damage?



=== modified file 'lisp/isearch.el'
*** lisp/isearch.el	2011-08-25 20:48:45 +0000
--- lisp/isearch.el	2011-08-29 20:46:30 +0000
***************
*** 1920,1925 ****
--- 1920,1926 ----
  	   (if (lookup-key global-map key)
  	       (progn
  		 (isearch-done)
+ 		 (setq prefix-arg arg)
  		 (apply 'isearch-unread keylist))
  	     (setq keylist
  		   (listify-key-sequence (lookup-key local-function-key-map key)))
***************
*** 1935,1940 ****
--- 1936,1942 ----
  		     (setq keylist (cdr keylist)))
  		 ;; As the remaining keys in KEYLIST can't be handled
  		 ;; here, we must reread them.
+ 		 (setq prefix-arg arg)
  		 (apply 'isearch-unread keylist)
  		 (setq keylist nil)))))
  	  (
***************
*** 1957,1964 ****
--- 1959,1968 ----
  			       isearch-other-control-char)))))
  	   (setcar keylist (- main-event (- ?\C-\S-a ?\C-a)))
  	   (cancel-kbd-macro-events)
+ 	   (setq prefix-arg arg)
  	   (apply 'isearch-unread keylist))
  	  ((eq search-exit-option 'edit)
+ 	   (setq prefix-arg arg)
  	   (apply 'isearch-unread keylist)
  	   (isearch-edit-string))
            ;; Handle a scrolling function.
***************
*** 1987,1992 ****
--- 1991,1997 ----
  	   (isearch-edit-string))
  	  (search-exit-option
  	   (let (window)
+ 	     (setq prefix-arg arg)
               (isearch-unread-key-sequence keylist)
               (setq main-event (car unread-command-events))
  


-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2011-08-29 21:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29 21:06 Alan Mackenzie [this message]
2011-08-29 21:33 ` Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix Juri Linkov
2011-08-29 22:21   ` Alan Mackenzie

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=20110829210659.GC2908@acm.acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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.