unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Rankin <hello@paulwrankin.com>
Cc: tino.calancha@gmail.com, 27634@debbugs.gnu.org
Subject: bug#27634: 25.2.1; C-g does not quit register-read-with-preview
Date: Mon, 10 Jul 2017 20:06:21 +0300	[thread overview]
Message-ID: <83shi4i5ma.fsf@gnu.org> (raw)
In-Reply-To: <1499671255.3837111.1035640480.1DBD693E@webmail.messagingengine.com> (message from Paul Rankin on Mon, 10 Jul 2017 17:20:55 +1000)

> From: Paul Rankin <hello@paulwrankin.com>
> Cc: 27634@debbugs.gnu.org, Eli Zaretskii <eliz@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?





  parent reply	other threads:[~2017-07-10 17:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10  3:58 bug#27634: 25.2.1; C-g does not quit register-read-with-preview Paul Rankin
2017-07-10  6:33 ` Tino Calancha
2017-07-10  7:20   ` Paul Rankin
2017-07-10  7:59     ` Tino Calancha
2017-07-10 17:06     ` Eli Zaretskii [this message]
2017-07-11  4:14       ` Paul Rankin
2017-07-11  4:48         ` Tino Calancha
2017-07-11  5:07           ` Paul Rankin
2017-07-11  5:50             ` Tino Calancha
2017-07-11  7:20               ` Andreas Schwab
2017-07-11 14:36         ` Eli Zaretskii
2017-07-12  2:12           ` Paul Rankin
2017-07-10 19:01   ` Andreas Schwab
2017-07-21  3:47 ` Allen Li
2017-07-21  6:19   ` Tino Calancha
2017-07-21  8:40     ` Eli Zaretskii
2017-07-21  8:55       ` Tino Calancha
2017-07-25  2:45         ` Tino Calancha

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83shi4i5ma.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=27634@debbugs.gnu.org \
    --cc=hello@paulwrankin.com \
    --cc=tino.calancha@gmail.com \
    /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 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).