GNU bug report logs -
#69893
29.2; Valid key "<TAB>" not accepted by `keymap-global-set'
Previous Next
Reported by: tpeplt <tpeplt <at> gmail.com>
Date: Tue, 19 Mar 2024 04:06:03 UTC
Severity: normal
Found in version 29.2
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69893 in the body.
You can then email your comments to 69893 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69893
; Package
emacs
.
(Tue, 19 Mar 2024 04:06:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
tpeplt <tpeplt <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 19 Mar 2024 04:06:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Recipe for reproducing this problem:
1. Start Emacs at a shell prompt using "emacs -Q".
2. Evaluate the following expressions in the *scratch* buffer.
The following keys evaluate as valid (as expected):
(key-valid-p "TAB")
(key-valid-p "<TAB>")
(key-valid-p "<tab>")
The following key evaluates as invalid (as expected):
(key-valid-p "tab")
3. So, the following expressions should evaluate to
‘indent-for-tab-command’:
(keymap-global-set "<tab>" 'indent-for-tab-command)
(keymap-global-set "TAB" 'indent-for-tab-command)
(keymap-global-set "<TAB>" 'indent-for-tab-command)
The first two expressions evaluate as expected, but when the third
expression is evaluated, then the following message is reported:
keymap-global-set: To bind the key TAB, use [?\t], not [TAB]
Because (key-valid-p "<TAB>") evaluates to t, that error message appears
to be invalid.
4. Also, the following expressions all evaluate to nil:
(key-valid-p "[?\t]")
(key-valid-p "[?\\t]")
(key-valid-p "?\t")
(key-valid-p "?\\t")
(key-valid-p "<?\t>")
(key-valid-p "<?\\t>")
So the error message appears to direct a user to change the key string
to an invalid key.
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69893
; Package
emacs
.
(Thu, 21 Mar 2024 12:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 69893 <at> debbugs.gnu.org (full text, mbox):
> From: tpeplt <tpeplt <at> gmail.com>
> Date: Mon, 18 Mar 2024 17:14:16 -0400
>
> Recipe for reproducing this problem:
>
> 1. Start Emacs at a shell prompt using "emacs -Q".
>
> 2. Evaluate the following expressions in the *scratch* buffer.
>
> The following keys evaluate as valid (as expected):
>
> (key-valid-p "TAB")
> (key-valid-p "<TAB>")
> (key-valid-p "<tab>")
>
> The following key evaluates as invalid (as expected):
>
> (key-valid-p "tab")
>
> 3. So, the following expressions should evaluate to
> ‘indent-for-tab-command’:
>
> (keymap-global-set "<tab>" 'indent-for-tab-command)
> (keymap-global-set "TAB" 'indent-for-tab-command)
> (keymap-global-set "<TAB>" 'indent-for-tab-command)
>
> The first two expressions evaluate as expected, but when the third
> expression is evaluated, then the following message is reported:
>
> keymap-global-set: To bind the key TAB, use [?\t], not [TAB]
>
> Because (key-valid-p "<TAB>") evaluates to t, that error message appears
> to be invalid.
>
> 4. Also, the following expressions all evaluate to nil:
>
> (key-valid-p "[?\t]")
> (key-valid-p "[?\\t]")
>
> (key-valid-p "?\t")
> (key-valid-p "?\\t")
>
> (key-valid-p "<?\t>")
> (key-valid-p "<?\\t>")
>
> So the error message appears to direct a user to change the key string
> to an invalid key.
Stefan, is the below the right fix for this?
If not, why does key-parse omit TAB from the list of specially-handled
keys?
diff --git a/lisp/keymap.el b/lisp/keymap.el
index d2544e3..b2b475c 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -260,7 +260,7 @@ key-parse
(setq word (concat (match-string 1 word)
(match-string 3 word)))
(not (string-match
- "\\<\\(NUL\\|RET\\|LFD\\|ESC\\|SPC\\|DEL\\)$"
+ "\\<\\(NUL\\|RET\\|LFD\\|TAB\\|ESC\\|SPC\\|DEL\\)$"
word))))
(setq key (list (intern word))))
((or (equal word "REM") (string-match "^;;" word))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69893
; Package
emacs
.
(Thu, 21 Mar 2024 19:48:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 69893 <at> debbugs.gnu.org (full text, mbox):
> Stefan, is the below the right fix for this?
Looks correct to me.
That code dates back to
commit 629d4dcd2a184da6a0b246d31f152a84327db51a
Author: Richard M. Stallman <rms <at> gnu.org>
Date: Tue Sep 21 03:44:04 1993 +0000
Total rewrite by Gillespie.
and I suspect it was just an oversight.
Stefan
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Thu, 21 Mar 2024 20:15:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
tpeplt <tpeplt <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 21 Mar 2024 20:15:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 69893-done <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: tpeplt <tpeplt <at> gmail.com>, 69893 <at> debbugs.gnu.org
> Date: Thu, 21 Mar 2024 15:46:08 -0400
>
> > Stefan, is the below the right fix for this?
>
> Looks correct to me.
> That code dates back to
>
> commit 629d4dcd2a184da6a0b246d31f152a84327db51a
> Author: Richard M. Stallman <rms <at> gnu.org>
> Date: Tue Sep 21 03:44:04 1993 +0000
>
> Total rewrite by Gillespie.
>
> and I suspect it was just an oversight.
Thanks, installed on the emacs-29 branch, and closing the bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 19 Apr 2024 11:24:25 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.