Subject: bug#69893: closed (Re: bug#69893: 29.2; Valid key "<TAB>" not accepted by `keymap-global-set')

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 21 Mar 2024 20:15:02 +0000

Your bug report

#69893: 29.2; Valid key "<TAB>" not accepted by `keymap-global-set'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
69893: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69893
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#69893: 29.2; Valid key "<TAB>" not accepted by `keymap-global-set'
From: Eli Zaretskii <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 21 Mar 2024 22:13:52 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Stefan Monnier <[email-masked]>
> Cc: tpeplt <[email-masked]>,  [email-masked]
> 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 <[email-masked]>
>     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.

Subject: 29.2; Valid key "<TAB>" not accepted by `keymap-global-set'
From: tpeplt <[email-masked]>
To: [email-masked]
Date: Mon, 18 Mar 2024 17:14:16 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

--