GNU bug report logs -
#27634
25.2.1; C-g does not quit register-read-with-preview
Previous Next
Reported by: Paul Rankin <hello <at> paulwrankin.com>
Date: Mon, 10 Jul 2017 04:00:02 UTC
Severity: minor
Merged with 25370
Found in versions 25.1.90, 25.2.1
Done: Tino Calancha <tino.calancha <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Paul Rankin <hello <at> paulwrankin.com>
> Cc: 27634 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
> Date: Mon, 10 Jul 2017 17:20:55 +1000
>
> On Mon, 10 Jul 2017, at 04:33 PM, Tino Calancha wrote:
> > How about the following?
> >
> > @@ -164,6 +164,8 @@ register-read-with-preview
> > help-chars)
> > (unless (get-buffer-window buffer)
> > (register-preview buffer 'show-empty)))
> > + (when (eq (string-to-char "\C-g") last-input-event)
> > + (keyboard-quit))
> > (if (characterp last-input-event) last-input-event
> > (error "Non-character input-event")))
> > (and (timerp timer) (cancel-timer timer))
>
> I think that's more a bandaid than fixing the root of the problem, which is that the manual tells the user that register names are alphanumeric characters (and I assume 99% of users only use alphanumeric characters) but the function doesn't test for this. e.g. testing for C-g doesn't catch for ^L or ^M, etc.
FWIW, I actually agree with Tino's solution, and was about to propose
something similar. It's true that control characters are not
alphanumeric, but we could fix the documentation to be more accurate
if we care about that. OTOH, we've supported control characters as
register names for many years, and by now it should be quite clear it
didn't bother anyone yet.
C-g needs indeed to generate keyboard quit, and perhaps ESC ESC as
well. I'd look at read-char-choice for inspiration.
> If we want to be strict about it, this might work:
>
> @@ -164,8 +164,8 @@
> help-chars)
> (unless (get-buffer-window buffer)
> (register-preview buffer 'show-empty)))
> - (if (characterp last-input-event) last-input-event
> - (error "Non-character input-event")))
> + (if (= (char-syntax last-input-event) 119) last-input-event
> + (error "Register name must be alphanumeric")))
> (and (timerp timer) (cancel-timer timer))
> (let ((w (get-buffer-window buffer)))
> (and (window-live-p w) (delete-window w)))
>
> That prohibits anything except "a-zA-Z0-9", although users may want to save registers to "$" or "*".
Why would we want to be so strict when the only real problem is that
C-g doesn't quit?
This bug report was last modified 7 years and 305 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.