Subject: 25.2.1; C-g does not quit register-read-with-preview
From: Paul Rankin <[email-masked]>
To: [email-masked]
Date: Mon, 10 Jul 2017 13:58:54 +1000
List-Id: <debbugs-submit.debbugs.gnu.org>

When saving to a register C-g does not quit but instead saves to the register "C-g".

To reproduce:

1. $ emacs -Q
2. M-x point-to-register [C-x r SPC]
3. C-g

Expected results:

C-g should call keyboard-quit and escape point-to-register

Actual results:

Point marker is saved to register "C-g".

This runs counter to expected behaviour with both quitting from saving a register, and in quitting from recalling a register, e.g. by attempting to quit from saving a point to register in buffer-A with C-g, when the user then attempts to keyboard-quit from jump-to-register [C-x r j C-g] he/she will be returned to point in buffer-A.

The root of the problem appears to be that register-read-with-preview only tests input with characterp:

(characterp ?^G) -> t

This appears to conflict with the Emacs manual entry on registers, which states that registers can be a letters or numbers:

> Each register has a name that consists of a single character, which
> we will denote by R; R can be a letter (such as ‘a’) or a number (such
> as ‘1’); case matters, so register ‘a’ is not the same as register ‘A’.

(info "(emacs) Registers")

I have worked around this with the following patch to register.el.gz:

@@ -164,7 +164,7 @@
 		       help-chars)
 	    (unless (get-buffer-window buffer)
 	      (register-preview buffer 'show-empty)))
-	  (if (characterp last-input-event) last-input-event
+	  (if (< 31 last-input-event 127) last-input-event
 	    (error "Non-character input-event")))
       (and (timerp timer) (cancel-timer timer))
       (let ((w (get-buffer-window buffer)))

However, I think this will not work on international keyboards and so is probably a poor fix.

Configuration:

GNU Emacs 25.2.1 (x86_64-apple-darwin16.6.0, NS appkit-1504.83 Version 10.12.5 (Build 16F73)) of 2017-06-06
macOS 10.12.5 (16F73)

MacBook Pro (Retina, 15-inch, Mid 2014)
2.2 GHz Intel Core i7
16 GB 1600 MHz DDR3
Intel Iris Pro 1536 MB

--
www.paulwrankin.com