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#74983: [PATCH] Use `keymap-set' instead of `define-key' in emacs lisp intro Date: Thu, 19 Dec 2024 14:36:29 -0800 Message-ID: <20241219223632.37894-1-hong@topbug.net> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="623"; mail-complaints-to="usenet@ciao.gmane.io" To: 74983@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 19 23:37:18 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 1tOP8w-000AXL-HR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Dec 2024 23:37:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOP8j-00015v-0V; Thu, 19 Dec 2024 17:37:05 -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 1tOP8g-00015Y-Rk for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:37: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 1tOP8g-0003Ix-JU for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:37: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:From:To:Subject; bh=3Or8G3ElSJnTKJeDQeo+FlM4Uwn1v7gxcXN2aCd8zZg=; b=iRw/EilRPhbgrfnENhqy8GI9aOZoc1Bqn7w/l46+Xpy0vo6Z/c5DKujnBQd66k6TVsFaFTTGrNuzuz1WtUIjLFg7T3jNMx+XIF7on5dJI2EXVousN01xw1SBE86Y3coBVfzNGXPeRVVBzX5/yOZsUVYqA9vty7r0l79VPCVEafL7WQdCVjyv35fble/rDsE2YDwdyqw1KdVeZZEXPeBB6bKRn/Dwd3zQOY8n2Jr2975e2HLlFX65KT8cjQFVk5MYlG2NCl1jxWwofN7Fu1//WnCPyjKeGYBHwPBbr08ODmYfjzDY5iWcSnvaTEylcg7X2OAW2KvVD1bEf3gHC90VUg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOP8g-0000bH-7o for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:37: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: Thu, 19 Dec 2024 22:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17346478082281 (code B ref -1); Thu, 19 Dec 2024 22:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Dec 2024 22:36:48 +0000 Original-Received: from localhost ([127.0.0.1]:40520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOP8R-0000ai-NR for submit@debbugs.gnu.org; Thu, 19 Dec 2024 17:36:48 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOP8Q-0000ab-4D for submit@debbugs.gnu.org; Thu, 19 Dec 2024 17:36:46 -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 1tOP8P-00011E-TF for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:36:45 -0500 Original-Received: from sender4-of-o54.zoho.com ([136.143.188.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOP8L-0003HC-QC for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2024 17:36:43 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1734647795; cv=none; d=zohomail.com; s=zohoarc; b=JctJRyQGfK8Sckfx5wzcl7xySSe7u/jPYqSiif8WkbaCZV9Two3ApH1XRO3urPZ0eZIEks1EflPshxqOITW/o0vK8uZwYCahycCQm4oq3CU5lBNcOLJqa+tqEgo1ARTDy2lLu0qzI6kwdf0sWo/LjHeQ1+1xF63CIgPf/LXNPso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734647795; h=Content-Transfer-Encoding:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=3Or8G3ElSJnTKJeDQeo+FlM4Uwn1v7gxcXN2aCd8zZg=; b=b5G+m/NpSW0FM9YnwTzvl/cwHCNCBPZASTkjWTHTWcj/WdUIPCE6NCm/8aGJnvLVIQfj+cqvI2j/HxOBgu8nAp61TNJlkXUKkZYSt6RoRwIQUwfjlPazj3H7DGTH6mOeCGsI93pUHsxPfCMREm5lW8ympNvns1q0Qj+R5ME0zkg= 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=1734647795; s=zoho; d=topbug.net; i=hong@topbug.net; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=3Or8G3ElSJnTKJeDQeo+FlM4Uwn1v7gxcXN2aCd8zZg=; b=SvNS6sYSPE/6dJOT5rE+sCpopWkFfft74Q2O18oVyjY5hPXi2wNIJIU2ZzJRelzG FvwmXZ2SSgICoOQViK5lZBYaMHclH9dgKPN9fU+Gk7/VzydKsMjTC0/rtt6TmeeP6xH bPQTyv+PlfepaRhg9eCO+E4jmi5poJEQ4cEq9S4A= Original-Received: by mx.zohomail.com with SMTPS id 1734647793834678.8117045148588; Thu, 19 Dec 2024 14:36:33 -0800 (PST) X-Mailer: git-send-email 2.47.1 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.54; envelope-from=hong@topbug.net; helo=sender4-of-o54.zoho.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.116, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:297414 Archived-At: * Since `define-key' is considered legacy and we encourage `keymap-set' now. --- doc/lispintro/emacs-lisp-intro.texi | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 49916235fbf9..32ad07785c20 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -17358,15 +17358,14 @@ Keymaps (global-set-key "\C-x\C-b" 'buffer-menu) @end smallexample -Mode-specific keymaps are bound using the @code{define-key} function, +Mode-specific keymaps are bound using the @code{keymap-set} function, which takes a specific keymap as an argument, as well as the key and -the command. For example, my @file{.emacs} file contains the -following expression to bind the @code{texinfo-insert-@@group} command -to @kbd{C-c C-c g}: +the command. For example, the following expression binds the +@code{texinfo-insert-@@group} command to @kbd{C-c C-c g}: @smallexample @group -(define-key texinfo-mode-map "\C-c\C-cg" 'texinfo-insert-@@group) +(keymap-set texinfo-mode-map "C-c C-c g" 'texinfo-insert-@group) @end group @end smallexample @@ -17396,7 +17395,7 @@ Keymaps write a function to insert a word; but I prefer key strokes consistent with other Texinfo mode key bindings.) -You will see numerous @code{define-key} expressions in +You will see numerous @code{keymap-set} expressions in @file{loaddefs.el} as well as in the various mode libraries, such as @file{cc-mode.el} and @file{lisp-mode.el}. -- 2.47.1