From unknown Sat Aug 09 15:16:25 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61185 <61185@debbugs.gnu.org> To: bug#61185 <61185@debbugs.gnu.org> Subject: Status: 29.0.60; key-parse is not as strict as the other keymap APIs Reply-To: bug#61185 <61185@debbugs.gnu.org> Date: Sat, 09 Aug 2025 22:16:25 +0000 retitle 61185 29.0.60; key-parse is not as strict as the other keymap APIs reassign 61185 emacs submitter 61185 Daniel Mendler severity 61185 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 16:02:08 2023 Received: (at submit) by debbugs.gnu.org; 30 Jan 2023 21:02:08 +0000 Received: from localhost ([127.0.0.1]:50709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMbHz-0006mk-Sb for submit@debbugs.gnu.org; Mon, 30 Jan 2023 16:02:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:35252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMbHx-0006mb-EZ for submit@debbugs.gnu.org; Mon, 30 Jan 2023 16:02:05 -0500 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 1pMbHw-0003U2-Pp for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2023 16:02:04 -0500 Received: from server.qxqx.de ([2a01:4f8:121:346::180] helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMbHu-0005mG-8G for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2023 16:02:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:Cc:To:Subject:From :MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ymtz6BPCzBIBSBNf5W+hlPVRAK8tD8ZqTvQf22yI8EA=; b=c1a1P4UWEhU+BRbKKhc/bbTDi0 nNXx+dhf7N4483UBrNV1BjaMJXiVW2nA/exSued0T5yRqP+jIA/owprMs/vLxw4jvxagkp5kLGUrh yoDfl5AgxfmF61o16aeiAVDttnS6vOHqK+34IgupAtf/e73wuxYCCBSkhLSlr9OtssxE=; Message-ID: Date: Mon, 30 Jan 2023 22:01:56 +0100 MIME-Version: 1.0 From: Daniel Mendler Subject: 29.0.60; key-parse is not as strict as the other keymap APIs To: bug-gnu-emacs@gnu.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Lars Ingebrigtsen , Robert Pluim , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) The function `key-parse' is publicly exposed as part of the keymap.el API. As such it would be good if it were as strict as the rest of the API to improve consistency. Currently it accepts strings which are invalid according to `key-valid-p'. (key-valid-p "bug") ;; nil (key-parse "bug") ;; [98 117 103] We can move the `key-valid-p' check to `key-parse'. This would alleviate the need for many additional `key-valid-p' checks across keymap.el. Then the `keymap--check' helper can even be removed. There is the small complication that `kbd' has been reimplemented based on `key-parse' which prevents `key-parse' from being more strict. One can either introduce an internal `key--parse-lax' function which is then used by `kbd' and `key-parse'.