From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Panagiotis Koutsourakis Newsgroups: gmane.emacs.bugs Subject: bug#60859: [PATCH] Remove reference to the kbd function from documentation Date: Tue, 17 Jan 2023 16:20:38 +0200 Message-ID: <87edrt6y4p.fsf@panoramix.zarniwoop.org> References: <87pmbeivcl.fsf@panoramix.zarniwoop.org> <83ilh64juj.fsf@gnu.org> <87o7qyo3nc.fsf@panoramix.zarniwoop.org> <83cz7e4dve.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="5167"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 60859@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 17 15:21:32 2023 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 1pHmq9-0000yI-JM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Jan 2023 15:21:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHmpo-0005GW-5d; Tue, 17 Jan 2023 09:21:08 -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 1pHmpi-0005FF-Rp for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 09:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHmpi-00022j-4a for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 09:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHmph-0000oj-Og for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 09:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Panagiotis Koutsourakis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 14:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60859 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60859-submit@debbugs.gnu.org id=B60859.16739652603128 (code B ref 60859); Tue, 17 Jan 2023 14:21:01 +0000 Original-Received: (at 60859) by debbugs.gnu.org; 17 Jan 2023 14:21:00 +0000 Original-Received: from localhost ([127.0.0.1]:36169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHmpg-0000oN-BE for submit@debbugs.gnu.org; Tue, 17 Jan 2023 09:21:00 -0500 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:43565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHmpe-0000o9-9N for 60859@debbugs.gnu.org; Tue, 17 Jan 2023 09:20:59 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id F159C3200033 for <60859@debbugs.gnu.org>; Tue, 17 Jan 2023 09:20:51 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 17 Jan 2023 09:20:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= slartibartfast.net; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1673965251; x= 1674051651; bh=jTfegDTmFoHWTnyZ57FmjSAeWy4t+GoKFqrJw5pFrxI=; b=T ShGoR2CYYssMZUjPuHtZj8aNGOVYtuP2IY1SIG75jQzlgXWfHnC7w9HbKRA7FM70 3Dp3m68VvAV5588JyS4OkQVebRUhxe3pdUcaDr43zgumSgIJWqosNuK0YD47hqvc Y685ILErD3AeK/dIhBqthE/CRaEneea95C36V/QYIfC2jz70d8SiMZ3/1xbBD6tn KfDqEGoPkGy+sLk16T2G2p90VuQ/0SshauQwg2/DZe082H10+68mponj73rbsrte jj8q6f9OGXeJkgMpsVVlSb7lAOwAX0eo6fVAYXjjWpZaf3Vfm2qgZqeP76YgO1Oq PITAXe8X6bo9JpPZVQKNg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673965251; x=1674051651; bh=jTfegDTmFoHWTnyZ57FmjSAeWy4t +GoKFqrJw5pFrxI=; b=SxkI/WEam2lpz16zLW3rc76kQblJHJ6gFD9rVv53pNLZ tkkmADvsvtMlORQm4fdCXkepK/79w9DawC2K6/FeDEy2z4w31j+Hv8tDTBZTq+/U Kem0jicQ+OfR8mbgS8FRAY0TSDSshn/Ng7qJObOifAuj4TYsKs8MTAGJlhbGVsdL H//ORXz3McDEalj7M2ZXFKIoCAEujRnt3bap5HZonEeGlUivFKKUbJoWhAfIPfSH 7z4hAT4Y47OC+ltGH2MXy8cbOLDOMvkP70+x9gTsDX+LW9H03QnWIUvoOpFRsGiY YrQl/FzXegB529+FVs/rmq4VJE63skm6PjF0q9QalQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtiedgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffujghffffkfgggtgesmhdtre ertdertdenucfhrhhomheprfgrnhgrghhiohhtihhsucfmohhuthhsohhurhgrkhhishcu oehkuhhtshhurhgrkhesshhlrghrthhisggrrhhtfhgrshhtrdhnvghtqeenucggtffrrg htthgvrhhnpeetfeevteevhfegkeejheegheekgfdvffduhfeigedtleehfeegudekleet jeejfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hkuhhtshhurhgrkhesshhlrghrthhisggrrhhtfhgrshhtrdhnvght X-ME-Proxy: Feedback-ID: iaac9463b:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for <60859@debbugs.gnu.org>; Tue, 17 Jan 2023 09:20:50 -0500 (EST) In-Reply-To: <83cz7e4dve.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2023 18:56:37 +0200") 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:253553 Archived-At: --=-=-= Content-Type: text/plain On Mon, Jan 16 2023, Eli Zaretskii wrote: > > I prefer to keep the description of 'kbd' in the manual. We can (and > probably should) reword the text if we are going to the > 'keymap-global-set' alternative, and we should probably describe the > latter first. Here's a second attempt. I added a brief example using `global-set-key' and `kbd'. I also added a link to the relevant section in the elisp reference manual and some findex directives. Best regards, Panos. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Reword-user-documentation-on-binding-keys-in-lisp.patch >From 5f338f0c7cad1898825c9b1b17ae92c08224c5f8 Mon Sep 17 00:00:00 2001 From: Panagiotis Koutsourakis Date: Tue, 17 Jan 2023 15:42:35 +0200 Subject: [PATCH] ; Reword user documentation on binding keys in lisp --- doc/emacs/custom.texi | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 91df15a21d7..5abe92ed43c 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1887,13 +1887,11 @@ Init Rebinding you can specify them in your initialization file by writing Lisp code. @xref{Init File}, for a description of the initialization file. -@findex kbd - There are several ways to write a key binding using Lisp. The -simplest is to use the @code{kbd} function, which converts a textual -representation of a key sequence---similar to how we have written key -sequences in this manual---into a form that can be passed as an -argument to @code{keymap-global-set}. For example, here's how to bind -@kbd{C-z} to the @code{shell} command (@pxref{Interactive Shell}): +@findex keymap-global-set + The recommended way to write a key binding using Lisp is to use one +of the @code{keymap-global-set}, or @code{keymap-set} functions. For +example, here's how to bind @kbd{C-z} to the @code{shell} command in +the global keymap (@pxref{Interactive Shell}): @example (keymap-global-set "C-z" 'shell) @@ -1920,6 +1918,24 @@ Init Rebinding Language and coding systems may cause problems with key bindings for non-@acronym{ASCII} characters. @xref{Init Non-ASCII}. +@findex global-set-key +@findex define-key + Alternatively you can use the low level functions @code{define-key} +and @code{global-set-key}. For example to bind @kbd{C-z} to the +@code{shell} command as in the above example, use: + +@example +(global-set-key (kbd "C-z") 'shell) +@end example + +@findex kbd +@noindent +Please note that these functions do not accept a simple string to +specify the binding but need a key sequence. The easiest way to +produce one is to use the function @code{kbd}. For more details about +binding keys using Lisp @ref{Keymaps,,, elisp, The Emacs Lisp +Reference Manual}. + @findex keymap-set @findex keymap-unset As described in @ref{Local Keymaps}, major modes and minor modes can -- 2.39.0 --=-=-=--