* 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
* Re: Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.
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
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2011-08-29 21:33 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> 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.
Please note that it works correctly on X, but fails on a tty.
So this is a tty-specific bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug #8901: (C-u C-<space> fails in Isearch) - proposed fix.
2011-08-29 21:33 ` Juri Linkov
@ 2011-08-29 22:21 ` Alan Mackenzie
0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2011-08-29 22:21 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Hi, Juri.
On Tue, Aug 30, 2011 at 12:33:28AM +0300, Juri Linkov wrote:
> > 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.
> Please note that it works correctly on X, but fails on a tty.
> So this is a tty-specific bug.
I hadn't actually tried it on X. ;-(
I have now, though. The difference seems to be (with C-h l):
tty: C-u C-@
X: C-u C-SPC
C-@ has an entry in local-function-key-map, which transforms it into the
vector [67108896] i.e. [2^26 + 32]. Because of this l-f-k-map entry, it
gets caught by the first arm of the cond in `isearch-other-meta-char',
where there's no handling for prefix-arg.
In the X case, C-SPC drops through to some arm where the prefix-arg does
get set. Probably.
It's too late for me to concentrate fully on this.
--
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).