From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Deprecation of define-key? Date: Tue, 02 Aug 2022 09:54:42 +0000 Message-ID: <87v8rbc6n1.fsf@posteo.net> References: <875yjgszm4.fsf@posteo.net> <87mtcr99mx.fsf@igel.home> <871qu2lt68.fsf@fau.de> <87sfmizump.fsf@gnus.org> <871qtzou8e.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18518"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Andreas Schwab , emacs-devel@gnu.org To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 02 12:24:49 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oIp4y-0004fY-Qa for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Aug 2022 12:24:48 +0200 Original-Received: from localhost ([::1]:52064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIp4x-0004jF-Mx for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Aug 2022 06:24:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIobx-0003z9-GQ for emacs-devel@gnu.org; Tue, 02 Aug 2022 05:54:49 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:43455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIobv-0003RC-OO for emacs-devel@gnu.org; Tue, 02 Aug 2022 05:54:49 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 40987240103 for ; Tue, 2 Aug 2022 11:54:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1659434085; bh=EUZbRSNt7PU8NzgxbRRnqcOeGwvFsOUQYuektbCUaR4=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=RZnhloM4rqfhLn3/lETFArqQOwZTBVLW477LNyUdcRhXv7T4pxSBEapi9whys/uPX SqzuTd2ICpIZXl0qhhYYyHUNYNUZrNsIPfJggu/EUik2cN7ZqBIThI/beA+MdDbb+l 31gSJWyijYEkP9NOl1BMXYXOPpkEIzvzrdREvlzKHHDVqCILqxBNGvXV7DXxRHqICG 3QpL0c+tl6l3eNW0gLY5BwUKcuOx7EnmAc7RcS63jRd0qKJyGCTn+K1knCgMSLmXk+ ZAZ402n4Q65vf3AC0flADg2PjWTdAQYRUHw1FPElet2wCt8GZxyoWky7rumpOCHXmy IdFuKjM3qoTqQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Lxr1v3j1tz6tmc; Tue, 2 Aug 2022 11:54:43 +0200 (CEST) In-Reply-To: <871qtzou8e.fsf@gmail.com> (Augusto Stoffel's message of "Tue, 02 Aug 2022 11:44:17 +0200") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292981 Archived-At: Augusto Stoffel writes: > On Sat, 30 Jul 2022 at 13:51, Lars Ingebrigtsen wrote: > >> Philip Kaludercic writes: >> >>> That is obvious, the question is should package developers avoid using >>> `define-key' if possible or not? >> >> As the doc string says -- `keymap-set' is the recommended function to >> use. However, `define-key' is not (and won't be) obsoleted, so it's up >> to them to follow the recommendation (or not). > > I didn't catch any of the previous discussion about keymap.el, but I > have a comment -- sorry if redundant. > > Wouldn't it make sense to let keymap-set take multiple key-definition > pairs as arguments, like setq et al? This would be very convenient > e.g. in user configuration files, where currently one often finds long > sequences of define-key calls. One thing I still don't understand about keymap (which is part of the reason I initiated this thread), is who the "target audience" is, if any? Core development, ELPA packages in general, user configurations, or someone else? > This looks much better to me: > > (keymap-set some-map > "a" 'command-a > "b" 'command-b > "c" 'command-c) Not quite the same, but that is what `defvar-keymap' allows you to do. E.g. (defvar-keymap gnus-undo-mode-map "C-M-_" #'gnus-undo "C-_" #'gnus-undo "C-x u" #'gnus-undo ;; many people are used to type `C-/' on GUI frames and get `C-_'. "C-/" #'gnus-undo) Just in this case binding a variable and defining a map is merged into one, instead of modifying an existing map.