unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.
@ 2011-08-29 21:06 Alan Mackenzie
  2011-08-29 21:33 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2011-08-29 21:06 UTC (permalink / raw)
  To: emacs-devel

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).



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-29 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 21:06 Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix Alan Mackenzie
2011-08-29 21:33 ` Juri Linkov
2011-08-29 22:21   ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).