bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27634: 25.2.1; C-g does not quit register-read-with-preview


From: Tino Calancha
Subject: bug#27634: 25.2.1; C-g does not quit register-read-with-preview
Date: Mon, 10 Jul 2017 16:59:26 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Mon, 10 Jul 2017, Paul Rankin wrote:

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.
Opps, you are right.

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 "*".
I cannot assure that i've never used "@" or "," as a register. Probably i did it several times.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]