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#74999: [PATCH v3] Recommend `keymap-set' instead of `define-key' in emacs lisp intro Date: Thu, 26 Dec 2024 10:20:11 +0200 Message-ID: <86ed1uzwhw.fsf@gnu.org> References: <86y1098pvj.fsf@gnu.org> <20241221080552.259664-1-hong@topbug.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7410"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74999@debbugs.gnu.org To: Hong Xu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 09:21:28 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 1tQj7W-0001mU-Hh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 09:21:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQj7A-0006v7-SL; Thu, 26 Dec 2024 03:21: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 1tQj78-0006uh-N9 for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:21:02 -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 1tQj77-0000Og-WC for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:21:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=C8VNq7YFNumwbIGN0yCrRct9kWx1chghIzbzhWbVE0U=; b=ohhXv87QQAAJt0HV1ts4hp6KMl/7cbJr9Z1729NANYPYJ4jcHNbbVbqUX3QHyZ2ywRdfdGcH8aJgCFikNMt8hoLELB24MSMuG2bKn0wRMUHEFcOKx+n2ClD2MDyjqNyydXkGGPT67GXMt4peiFVSk5CaotTBKUee4knIF70QFbp60H1X7Q5NMcOjZcGAX1LcFOhrbj/z0z1Uxgja+9xZNyBOdvCjyqBs+6ZWsDSKMliGt94HOtBskTkjnBvIdHZsf2SGlVXS80q/+XwYRJnS5q8Dsnsv54amytCWbBWQK5fY6/Wa9VjNMHxFAB4ZqyC/iK/9/lY28r0EhggMArKFtg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQj77-0000Gh-Qv for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2024 08:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74999 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74999-submit@debbugs.gnu.org id=B74999.1735201239988 (code B ref 74999); Thu, 26 Dec 2024 08:21:01 +0000 Original-Received: (at 74999) by debbugs.gnu.org; 26 Dec 2024 08:20:39 +0000 Original-Received: from localhost ([127.0.0.1]:39993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQj6k-0000Fr-MP for submit@debbugs.gnu.org; Thu, 26 Dec 2024 03:20:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQj6i-0000FT-Dj for 74999@debbugs.gnu.org; Thu, 26 Dec 2024 03:20:37 -0500 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 1tQj6c-0000LI-1T; Thu, 26 Dec 2024 03:20:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=C8VNq7YFNumwbIGN0yCrRct9kWx1chghIzbzhWbVE0U=; b=PRMIeaK022bO HxWqjK1WAB/Gqane1m2CpuSlUVV/O6BHWdgk94NFWRJGHk7xlknQka6HoZtUivKYeJfCqoqvMpqGb PC96U5cbXBB7FrUATGWQBKNjIpeWzL2GPAII2aKEyGr4fFaYWrTlj+3SOpcESTmLduoFgxjaCYMVm eEPxAmEPl1kDzndahwruKEuZ0GkNUTQuA3FwKIOyMNqmB8bFY7IUUq8q0OHJCReImlNE8dc0NZhEQ y+L4xo8V+7GvGoxmKdrVTMtz1dc3OY5FT0daU1NGLue5Bcs2ROj5EQbKzLweCi4VKHkPdBiTjuXk+ aiqq/N00lM+wBY9RNA21PQ==; In-Reply-To: <20241221080552.259664-1-hong@topbug.net> (message from Hong Xu on Sat, 21 Dec 2024 00:03:54 -0800) 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:297754 Archived-At: > From: Hong Xu > Date: Sat, 21 Dec 2024 00:03:54 -0800 > > * Since `define-key' is considered legacy and we encourage `keymap-set' > now. > --- > doc/lispintro/emacs-lisp-intro.texi | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) Thanks. I tried to install this, but the git-commit hook rejected the commit because Subject line is too long: Line longer than 78 characters in commit message Commit aborted; please see the file CONTRIBUTE Please format the patch using "git format-patch", and please commit the patch locally before you do so (assuming you have the hooks in your local clone), to make sure these problems are corrected before you send the patch here. More generally, global-set-key, discussed earlier in this section, is also obsolete, and we nowadays prefer keymap-global-set instead. So, if we want to modernize this part of the Emacs Lisp Intro manual, I think we should replace all the key-binding examples and the surrounding text in the manual to use the new keymap-* functions. It makes little sense to replace only define-key and leave the rest as they were. Would you like to submit a patch that takes care of these issues in a more thorough manner? > +While you are encouraged to use @code{keymap-set}, you likely would > +encounter @code{define-key} in various places. Historically, keymaps > +are bound using a lower-level function, @code{define-key}, which > +is now considered legacy. These two sentences should be in reverse order: first tell that historically we used define-key, then say that the reader is encouraged to use keymap-set. Thanks.