emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.


From: Alan Mackenzie
Subject: Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.
Date: Mon, 29 Aug 2011 21:06:59 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]