help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: define-key upon common-lisp-mode and inferior-lisp-mode


From: Eli Zaretskii
Subject: Re: define-key upon common-lisp-mode and inferior-lisp-mode
Date: Wed, 31 Aug 2022 15:42:08 +0300

> From: Alessandro Bertulli <alessandro.bertulli96@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 31 Aug 2022 14:04:50 +0200
> 
> 
> Eli Zaretskii <eliz@gnu.org> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]