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.help Subject: Re: define-key upon common-lisp-mode and inferior-lisp-mode Date: Wed, 31 Aug 2022 15:42:08 +0300 Message-ID: <83sflcshy7.fsf@gnu.org> References: <83o7w2ufa6.fsf@gnu.org> <7W8YIKpAyrHUHX3SntrisHnwBBj7wgmuFM_7SxKRuyyo1SeYNsqCgL4QAqmVoJ2n0YivGF1mUvpcaZi6mCDhD_6-O7Yzwj1WSBgriV2FQHI=@proton.me> <835yi9vqro.fsf@gnu.org> <831qsxvo20.fsf@gnu.org> <87h71sr4wv.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36759"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 31 14:42:11 2022 Return-path: Envelope-to: geh-help-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 1oTN2o-0009Oo-HI for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 31 Aug 2022 14:42:10 +0200 Original-Received: from localhost ([::1]:53946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTN2m-0007iC-Ng for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 31 Aug 2022 08:42:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTN2O-0007i3-5a for help-gnu-emacs@gnu.org; Wed, 31 Aug 2022 08:41:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTN2N-0007ij-RD for help-gnu-emacs@gnu.org; Wed, 31 Aug 2022 08:41:43 -0400 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=t0eJ+VuvjeCMy+7yddmBTtN6N6hP1yCm81siiJEeW1s=; b=l/CNUb3Sztwo u5uFVopzzCE/UC3Z07SaDy4xkuX/jxuchcSVmd7OlYxsAqUKcT9X2pFQn1SBDR5EwaQN0Jfyo/MUn Hum06qMccM9EY0dFCHLvILL6CKaVZ2cbdt4XbFlSMTwNw+cjDpJiB0TSWklgomGL7pQq8Pus0l43t 5zCiqkC4YbBcoIeyj13p49Z1+pWNh3cd3dwUSBxMvcR2eDo0hvpvWsm5JvzRMNnPsQoaUI0+u7nKn Hb1B8Q4kw7q74tdhYasfS4tAK+Z0NLDiDna7NYszEGYWW33z7YF9aTDUAWqsuypNmgEpzDuRGty7L S8vNrBS4sMBGD2YvDUVq1w==; Original-Received: from [87.69.77.57] (port=3512 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTN2N-0002Jz-4q for help-gnu-emacs@gnu.org; Wed, 31 Aug 2022 08:41:43 -0400 In-Reply-To: <87h71sr4wv.fsf@gmail.com> (message from Alessandro Bertulli on Wed, 31 Aug 2022 14:04:50 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139197 Archived-At: > From: Alessandro Bertulli > Cc: help-gnu-emacs@gnu.org > Date: Wed, 31 Aug 2022 14:04:50 +0200 > > > Eli Zaretskii writes: > > > Use local-set-key instead. > > > >> On the other modes I have been using > >> > >> (define-key emacs-lisp-mode-map (kbd "H-e") #'eval-last-sexp) > >> > >> The last seems more standard for many modes. > > > > I can only show you the better solutions, I cannot force you use them. > > The documentation says local-set-key is legacy, and should be replaced > by keymap-local-set. In the version which says that, use keymap-local-set, if you prefer that. But local-set-key is not going anywhere any time soon, so I wouldn't worry about that, if you need to write code for multiple versions of Emacs, or help people who might use released versions (which is what happens here). > But aside from that, I only use define-key, and it works pretty good. > What are the advantages of using keymap-local-set? When using define-key > with the mode specific map, I'm not polluting other keymaps. So why the > need for a local function? The advantage is that you don't need to care about the mode and its map. Which was a problem in this case, so I thought I was helping.