From: Tino Calancha <tino.calancha@gmail.com>
To: Allen Li <vianchielfaura@gmail.com>
Cc: Andreas Schwab <schwab@suse.de>,
Paul Rankin <hello@paulwrankin.com>,
27634@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
Subject: bug#27634: 25.2.1; C-g does not quit register-read-with-preview
Date: Fri, 21 Jul 2017 15:19:03 +0900 [thread overview]
Message-ID: <87h8y6fh2g.fsf@calancha-pc> (raw)
In-Reply-To: <CAJr1M6ewV-haOUEDAYEscOOk2bsc0pSNG1A+SY+C3_p2VvoQ=g@mail.gmail.com> (Allen Li's message of "Thu, 20 Jul 2017 20:47:32 -0700")
Allen Li <vianchielfaura@gmail.com> writes:
> It sounds like there's a general consensus on how to fix this. Tino, would you care to post a finalized patch?
OK.
> Note: bug#25370 is a duplicate of this, it should probably be marked closed, wontfix, etc.
Thanks, i merged this thread with your bug report.
Let's discuss following patch:
*) Call `keyboard-quit' whenever last-input-event is
?\C-g or 'escape or ?\C-\[.
**) Updated the manual to point out that non-alphanumeric
keys are valid to store registers as well.
Let me know if that is OK or if we need a fine-grained control.
--8<-----------------------------cut here---------------start------------->8---
commit 484faa217fe5a76d12ce266bc3f84737da73f0ae
Author: Tino Calancha <tino.calancha@gmail.com>
Date: Fri Jul 21 15:08:06 2017 +0900
register-read-with-preview: Quit if user input C-g or ESC
* lisp/register.el (register-read-with-preview):
Quit if user input C-g or ESC (bug#27634).
* doc/emacs/regs.texi (Registers): Update manual.
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index 7369f6b05b..40e3e2c1c3 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -15,7 +15,10 @@ Registers
Each register has a name that consists of a single character, which
we will denote by @var{r}; @var{r} can be a letter (such as @samp{a})
or a number (such as @samp{1}); case matters, so register @samp{a} is
-not the same as register @samp{A}.
+not the same as register @samp{A}. You can also set a register in
+non-alphanumeric characters, for instance @samp{*} or @samp{C-d}.
+Note, it's not possible to set a register in @samp{C-g} or @samp{ESC},
+because these keys are reserved to terminate interactive commands.
@findex view-register
A register can store a position, a piece of text, a rectangle, a
diff --git a/lisp/register.el b/lisp/register.el
index 7cc3ccd870..e395963f56 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -164,6 +164,10 @@ register-read-with-preview
help-chars)
(unless (get-buffer-window buffer)
(register-preview buffer 'show-empty)))
+ (when (or (eq ?\C-g last-input-event)
+ (eq 'escape last-input-event)
+ (eq ?\C-\[ last-input-event))
+ (keyboard-quit))
(if (characterp last-input-event) last-input-event
(error "Non-character input-event")))
(and (timerp timer) (cancel-timer timer))
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-07-21
Repository revision: 1d559e384b467b3f74e8b78695f124b561c884d9
next prev parent reply other threads:[~2017-07-21 6:19 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
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 [this message]
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=87h8y6fh2g.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=27634@debbugs.gnu.org \
--cc=hello@paulwrankin.com \
--cc=schwab@suse.de \
--cc=vianchielfaura@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).