From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#75366: [PATCH] Improve the doc of key-valid-p Date: Sat, 04 Jan 2025 13:43:23 -0800 Message-ID: <87y0zqtfus.fsf@topbug.net> References: <20250104203955.139589-1-hong@topbug.net> <864j2eb8ym.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21807"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.8; emacs 29.4 Cc: 75366@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 22:44:21 2025 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 1tUBwS-0005Wj-5O for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 22:44:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUBwD-00070v-U7; Sat, 04 Jan 2025 16:44:06 -0500 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 1tUBwB-00070W-4y for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:44:03 -0500 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 1tUBwA-00043r-Rm for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:44:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=gKBSSHFa/GJZlrRrJCcUsZum4dt9FedaVcolayoA+RU=; b=ofDtldXmQBDGQe5XGh4P6sFEJIp+3cNWu/BjcBM0+VEdMsXy9DTUeRBHU1A66Qg4RW0YUXepfKfCJB/inSwjq+LMkMdT/EqGQc6Uy8eqKYZHqcdO/LL4la7IVnl3iUIZYy1L4xE1KWMvgQiPLw2TtanaGFBVBVOP7rGt8rhBLyLZ4VnPyfn1A6TkmCyC5AS6YluthTHL4dUUBeFFbDAmREA7ThrGtUajEc3a8zcj4immfS7l7lorm5MPzHPu642yHEcfZV6T9tD3PCbMX0biAWnAAzh5A7WfCCcc7887hhLEbtTWqhNlNcebhbLOs0FNRRf8QTEkvNNwrjoEtRuDPw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUBwA-0006cc-Es for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75366 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 75366-submit@debbugs.gnu.org id=B75366.173602701925415 (code B ref 75366); Sat, 04 Jan 2025 21:44:02 +0000 Original-Received: (at 75366) by debbugs.gnu.org; 4 Jan 2025 21:43:39 +0000 Original-Received: from localhost ([127.0.0.1]:57729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUBvm-0006br-Qe for submit@debbugs.gnu.org; Sat, 04 Jan 2025 16:43:39 -0500 Original-Received: from sender4-of-o52.zoho.com ([136.143.188.52]:21248) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUBvj-0006bg-LP for 75366@debbugs.gnu.org; Sat, 04 Jan 2025 16:43:37 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1736027005; cv=none; d=zohomail.com; s=zohoarc; b=SVyqWwulYxhK+9WPV4nQuIkLj8NxBJf6+KNbt1kG81HQFM/YauNxQS6QOBa60VHulXUYFNCDGbUhZrtMGFQJTWOUG6O24VYycVSLCYzHoiDwCOC84V8PCruLUAMwinDgNDGtNWdkHismzlgg9oOM/sHEuP+JUu02w0Fqv0U/AKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736027005; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=gKBSSHFa/GJZlrRrJCcUsZum4dt9FedaVcolayoA+RU=; b=Vq6VgplOkwPuhe/HsNdxkv89UIiwexad+KJUCW5pIFpWUrKiL2W+3aJ0QWiUim0MFVCbBxm98SZlO5yFeFMMh15Mn4SVE3wKRTh5ZWC/5DDyq2vuUvofDBssN5eyEMvxNCWiSquWDgJQK7woRxLj5Fvc0AERmT/GZJtbUyrXrq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=topbug.net; spf=pass smtp.mailfrom=hong@topbug.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736027005; s=zoho; d=topbug.net; i=hong@topbug.net; h=From:From:To:To:Cc:Cc:Subject:Subject:In-Reply-To:References:Date:Date:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=gKBSSHFa/GJZlrRrJCcUsZum4dt9FedaVcolayoA+RU=; b=LwPe2xEotqT0riQGSYesJMyUfMTMqz/ziRK1MS26dBGFrbeVlaT0h8pHsS5OuM2n E976nFMKwGYrhmR9fSNFE58n5WPUWOOI4mXOg0YuimxrCKf01eSp8rSjfOpJRyjOjSg Vg+PxKaRNhgkXdUNOo45Ghcp95bzrekPLLVvqb2A= Original-Received: by mx.zohomail.com with SMTPS id 1736027003912110.68443935750008; Sat, 4 Jan 2025 13:43:23 -0800 (PST) In-Reply-To: <864j2eb8ym.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jan 2025 22:49:37 +0200") X-ZohoMailClient: External X-Zoho-Virus-Status: 1 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:298480 Archived-At: --=-=-= Content-Type: text/plain On 2025-01-04 Sat 12:49 GMT-08, Eli Zaretskii wrote: >> From: Hong Xu >> Date: Sat, 4 Jan 2025 12:37:53 -0800 >> >> * lisp/keymap.el (key-valid-p): Add an function key example. Mention >> as a cursor control key instead of a function key. Rename >> some "characters" to "key strokes" to be consistent with the terminology >> in the first paragraph. Briefly explain what an event may be. > > Thanks, but the changes you suggest to make are not really correct or > at least inaccurate (with the exception of adding ""). For > example, saying that "event may be a key stroke or a menu item" is > inaccurate, because is neither and so is . I attached an updated version to correct the event description. > > What is wrong with the current text that you think it needs these > changes? The current text reads a bit confusing to me. The function, based on its name and the current text, gives me an impression that this is only about key strokes as those on a keyboard. However, it's actually more than key strokes as those on a keyboard. (I've added a mouse example in the updated patch to further clarify this.) For example, the "Modifying Menus" node (correctly) cites this function in the context of binding a menu item. The docstring of this function and the citing text together can confuse a unfamiliar reader quite a bit. Perhaps the ultimate confusion point is the name of the function and the definition of key sequences and key strokes in the docstring, but these may be harder to change. > >> -These are the characters that have special shorthand syntax: >> +These key strokes have special shorthand syntax: >> NUL, RET, TAB, LFD, ESC, SPC, DEL. > > They are all characters, not key strokes. I changed them back to characters in the updated version. But based on the definition earlier, "each key stroke is either a single character, or the name of an event...", they are also key strokes. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-Improve-the-doc-of-key-valid-p.patch >From 73a686feae4327dd23a2d7c350b528ceed5d5119 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Sat, 4 Jan 2025 12:32:24 -0800 Subject: [PATCH v2] Improve the doc of key-valid-p * lisp/keymap.el (key-valid-p): Add an function key and mouse button example. Mention as a cursor control key instead of a function key. Briefly explain what an event may be. --- lisp/keymap.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/keymap.el b/lisp/keymap.el index 3aed1d4b4cac..d1ff52ea3974 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -327,21 +327,26 @@ key-valid-p with a single space character separating one key stroke from another. Each key stroke is either a single character, or the name of an -event, surrounded by angle brackets . In addition, any -key stroke may be preceded by one or more modifier keys. Finally, -a limited number of characters have a special shorthand syntax. +event, surrounded by angle brackets . An event may be +pushing a key, clicking on a menu item, pressing a mouse button, etc. +In addition, any key stroke may be preceded by one or more modifier +keys. Finally, a limited number of characters have a special shorthand +syntax. Here are some example of valid key sequences. \"f\" (the key `f') + \"\" (the function key named \"F6\") + \"\" (the mouse button named \"mouse-1\", commonly referred to as + the left button) \"S o m\" (a three-key sequence of the keys `S', `o' and `m') \"C-c o\" (a two-key sequence: the key `c' with the control modifier followed by the key `o') - \"H-\" (the function key named \"left\" with the hyper modifier) + \"H-\" (the cursor control key named \"left\" with the hyper modifier) \"M-RET\" (the \"return\" key with a meta modifier) \"C-M-\" (the \"space\" key with both the control and meta modifiers) -These are the characters that have special shorthand syntax: +These characters have special shorthand syntax: NUL, RET, TAB, LFD, ESC, SPC, DEL. Modifiers have to be specified in this order: -- 2.47.1 --=-=-= Content-Type: text/plain -- Hong --=-=-=--