From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69893: 29.2; Valid key "" not accepted by `keymap-global-set' Date: Thu, 21 Mar 2024 14:36:10 +0200 Message-ID: <86wmpv224l.fsf@gnu.org> References: <87plvr9r9z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24819"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69893@debbugs.gnu.org To: tpeplt , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 21 13:37:38 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rnHfu-0006DE-Kk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Mar 2024 13:37:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rnHfh-0000XA-4H; Thu, 21 Mar 2024 08:37:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rnHfe-0000Wk-Sg for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2024 08:37:22 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rnHfe-0003l2-8Z for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2024 08:37:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rnHgI-00029w-4q for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2024 08:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Mar 2024 12:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69893 X-GNU-PR-Package: emacs Original-Received: via spool by 69893-submit@debbugs.gnu.org id=B69893.17110246258216 (code B ref 69893); Thu, 21 Mar 2024 12:38:02 +0000 Original-Received: (at 69893) by debbugs.gnu.org; 21 Mar 2024 12:37:05 +0000 Original-Received: from localhost ([127.0.0.1]:35322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnHfN-00028R-4N for submit@debbugs.gnu.org; Thu, 21 Mar 2024 08:37:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rnHfI-00027q-GG for 69893@debbugs.gnu.org; Thu, 21 Mar 2024 08:37:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rnHeY-0003Z4-DY; Thu, 21 Mar 2024 08:36:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=uKM3txeHvas4zyj2KZw8thudp5NVGk/ZRp+tROReU84=; b=fdyu+7G/3xnON1n7cfMs dey+30c1iT+F41UZjOCQen2tAXIkZcX4WnfxK6/GeDTHqd+7otOmkWC1+wyZVFcOEqewONIDZvAFq fWdoWrAa758krPyidyp/i8S3TO4DRyr06LZucZXvd/oyh4cR9BSVyrgwxkOzleH53aOGS1CXYpJFO TQ/23JW4dtlLjIQpgmbMfhXQjgllcGggxwHDGn179gkyjUv2KWn2Puf3iIXNUFP3C2Y4XSTbrR6dW JrNErT26khfFq2X2zPQkkgr+Ee7yVm9xW90gj4vs0qyesZ0Ea0ip2N0m17FGH8LmZJ7BD+r5fyfYb e9P1tiFgj5SNCA==; In-Reply-To: <87plvr9r9z.fsf@gmail.com> (message from tpeplt on Mon, 18 Mar 2024 17:14:16 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281902 Archived-At: > From: tpeplt > 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 "") > (key-valid-p "") > > 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 "" 'indent-for-tab-command) > (keymap-global-set "TAB" 'indent-for-tab-command) > (keymap-global-set "" '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 "") 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 "") > (key-valid-p "") > > 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))