* define-key upon common-lisp-mode and inferior-lisp-mode @ 2022-08-30 4:59 wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 11:44 ` Eli Zaretskii 2022-08-30 13:24 ` Stefan Monnier via Users list for the GNU Emacs text editor 0 siblings, 2 replies; 17+ messages in thread From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-30 4:59 UTC (permalink / raw) To: Help Gnu Emacs Have encountered "common-lisp-mode" but there does not exist "common-lisp-mode-map". Thusly (define-key common-lisp-mode-map KEY DEF) fails Also seen "inferior-lisp-mode-map". which has no associated "inferior-lisp-mode". What is "inferior-lisp" and can one use it like lisp-mode? Does it make sense to call "define-key" upon "inferior-lisp-mode-map"? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 4:59 define-key upon common-lisp-mode and inferior-lisp-mode wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-30 11:44 ` Eli Zaretskii 2022-08-30 12:26 ` uzibalqa 2022-08-30 13:24 ` Stefan Monnier via Users list for the GNU Emacs text editor 1 sibling, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2022-08-30 11:44 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 30 Aug 2022 06:59:01 +0200 (CEST) > From: wilnerthomas--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> > > Have encountered "common-lisp-mode" but there does not exist "common-lisp-mode-map". > > Thusly (define-key common-lisp-mode-map KEY DEF) fails Its doc string says: In addition to any hooks its parent mode ‘lisp-data-mode’ might have run, this mode runs the hook ‘lisp-mode-hook’, as the final or penultimate step during initialization. So this mode inherits the keymap from its parent, lisp-data-mode. As for binding keys, it is better to use local-define-key, I think. It will figure out the keymap for you. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 11:44 ` Eli Zaretskii @ 2022-08-30 12:26 ` uzibalqa 2022-08-30 12:51 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: uzibalqa @ 2022-08-30 12:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, August 30th, 2022 at 11:44 AM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 30 Aug 2022 06:59:01 +0200 (CEST) > > From: wilnerthomas--- via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org > > > > Have encountered "common-lisp-mode" but there does not exist "common-lisp-mode-map". > > > > Thusly (define-key common-lisp-mode-map KEY DEF) fails > > > Its doc string says: > > In addition to any hooks its parent mode ‘lisp-data-mode’ might have > run, this mode runs the hook ‘lisp-mode-hook’, as the final or > penultimate step during initialization. > > So this mode inherits the keymap from its parent, lisp-data-mode. > > As for binding keys, it is better to use local-define-key, I think. > It will figure out the keymap for you. Like below? (local-define-key common-lisp-mode-map (kbd "H-e") #'eval-last-sexp) A bit non-standard compared to other modes. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 12:26 ` uzibalqa @ 2022-08-30 12:51 ` Eli Zaretskii 2022-08-30 13:22 ` uzibalqa 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2022-08-30 12:51 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 30 Aug 2022 12:26:42 +0000 > From: uzibalqa <uzibalqa@proton.me> > Cc: help-gnu-emacs@gnu.org > > > > Thusly (define-key common-lisp-mode-map KEY DEF) fails > > > > > > Its doc string says: > > > > In addition to any hooks its parent mode ‘lisp-data-mode’ might have > > run, this mode runs the hook ‘lisp-mode-hook’, as the final or > > penultimate step during initialization. > > > > So this mode inherits the keymap from its parent, lisp-data-mode. > > > > As for binding keys, it is better to use local-define-key, I think. > > It will figure out the keymap for you. > > Like below? > > (local-define-key common-lisp-mode-map (kbd "H-e") #'eval-last-sexp) Yes. > A bit non-standard compared to other modes. AFAIU, you are a user, not a programmer who defines a new mode. the above is the standard way for users to define key bindings for the current mode. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 12:51 ` Eli Zaretskii @ 2022-08-30 13:22 ` uzibalqa 2022-08-30 13:49 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: uzibalqa @ 2022-08-30 13:22 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, August 30th, 2022 at 12:51 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 30 Aug 2022 12:26:42 +0000 > > From: uzibalqa uzibalqa@proton.me > > Cc: help-gnu-emacs@gnu.org > > > > > > Thusly (define-key common-lisp-mode-map KEY DEF) fails > > > > > > Its doc string says: > > > > > > In addition to any hooks its parent mode ‘lisp-data-mode’ might have > > > run, this mode runs the hook ‘lisp-mode-hook’, as the final or > > > penultimate step during initialization. > > > > > > So this mode inherits the keymap from its parent, lisp-data-mode. > > > > > > As for binding keys, it is better to use local-define-key, I think. > > > It will figure out the keymap for you. > > > > Like below? > > > > (local-define-key common-lisp-mode-map (kbd "H-e") #'eval-last-sexp) > > > Yes. > > > A bit non-standard compared to other modes. > > > AFAIU, you are a user, not a programmer who defines a new mode. the > above is the standard way for users to define key bindings for the > current mode. Most of my time is spent doing programming work for others. Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 13:22 ` uzibalqa @ 2022-08-30 13:49 ` Eli Zaretskii 2022-08-30 14:15 ` uzibalqa 2022-08-31 12:04 ` Alessandro Bertulli 0 siblings, 2 replies; 17+ messages in thread From: Eli Zaretskii @ 2022-08-30 13:49 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 30 Aug 2022 13:22:48 +0000 > From: uzibalqa <uzibalqa@proton.me> > Cc: help-gnu-emacs@gnu.org > > Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 13:49 ` Eli Zaretskii @ 2022-08-30 14:15 ` uzibalqa 2022-08-30 15:25 ` tomas 2022-08-30 16:24 ` Eli Zaretskii 2022-08-31 12:04 ` Alessandro Bertulli 1 sibling, 2 replies; 17+ messages in thread From: uzibalqa @ 2022-08-30 14:15 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs ------- Original Message ------- On Tuesday, August 30th, 2022 at 1:49 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > Date: Tue, 30 Aug 2022 13:22:48 +0000 > > From: uzibalqa uzibalqa@proton.me > > Cc: help-gnu-emacs@gnu.org > > > > Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". > > > 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. What can be the origin of the Lisp Error? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 14:15 ` uzibalqa @ 2022-08-30 15:25 ` tomas 2022-08-30 18:21 ` wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 16:24 ` Eli Zaretskii 1 sibling, 1 reply; 17+ messages in thread From: tomas @ 2022-08-30 15:25 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 822 bytes --] On Tue, Aug 30, 2022 at 02:15:51PM +0000, uzibalqa wrote: > ------- Original Message ------- > On Tuesday, August 30th, 2022 at 1:49 PM, Eli Zaretskii <eliz@gnu.org> wrote: > > > > > Date: Tue, 30 Aug 2022 13:22:48 +0000 > > > From: uzibalqa uzibalqa@proton.me > > > Cc: help-gnu-emacs@gnu.org > > > > > > Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". > > > > > > 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. > > What can be the origin of the Lisp Error? What does the error message say, again? Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 15:25 ` tomas @ 2022-08-30 18:21 ` wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 18:41 ` tomas 0 siblings, 1 reply; 17+ messages in thread From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-30 18:21 UTC (permalink / raw) To: tomas; +Cc: help-gnu-emacs Aug 30, 2022, 15:25 by tomas@tuxteam.de: > On Tue, Aug 30, 2022 at 02:15:51PM +0000, uzibalqa wrote: > >> ------- Original Message ------- >> On Tuesday, August 30th, 2022 at 1:49 PM, Eli Zaretskii <eliz@gnu.org> wrote: >> >> >> > > Date: Tue, 30 Aug 2022 13:22:48 +0000 >> > > From: uzibalqa uzibalqa@proton.me >> > > Cc: help-gnu-emacs@gnu.org >> > > >> > > Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". >> > >> > >> > 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. >> >> What can be the origin of the Lisp Error? >> > > What does the error message say, again? > > Cheers > -- > t > > "Lisp error: (void-function local-define-key)" for "Emacs 27.2". That function does not exist. Neither does "common-lisp-mode-map", although the mode "common-lisp-mode" is available for use. And I am not able to use its parent, lisp-data-mode, lisp-data-mode-map, or similar. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 18:21 ` wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-30 18:41 ` tomas 2022-08-30 19:08 ` wilnerthomas--- via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 17+ messages in thread From: tomas @ 2022-08-30 18:41 UTC (permalink / raw) To: wilnerthomas; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 617 bytes --] On Tue, Aug 30, 2022 at 08:21:20PM +0200, wilnerthomas@tutanota.com wrote: > Aug 30, 2022, 15:25 by tomas@tuxteam.de: > > > On Tue, Aug 30, 2022 at 02:15:51PM +0000, uzibalqa wrote: [...] > >> What can be the origin of the Lisp Error? > >> > > > > What does the error message say, again? > > > > Cheers > > -- > > t > > > > > "Lisp error: (void-function local-define-key)" for "Emacs 27.2". > That function does not exist. Well, that's clear enough, isn't it? Do you think a function by that name should exist? If yes, why do you think that? If no, what is your problem? Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 18:41 ` tomas @ 2022-08-30 19:08 ` wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-31 12:11 ` Alessandro Bertulli 0 siblings, 1 reply; 17+ messages in thread From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-30 19:08 UTC (permalink / raw) To: tomas; +Cc: help-gnu-emacs Aug 30, 2022, 18:41 by tomas@tuxteam.de: > On Tue, Aug 30, 2022 at 08:21:20PM +0200, wilnerthomas@tutanota.com wrote: > >> Aug 30, 2022, 15:25 by tomas@tuxteam.de: >> >> > On Tue, Aug 30, 2022 at 02:15:51PM +0000, uzibalqa wrote: >> > > [...] > >> >> What can be the origin of the Lisp Error? >> >> >> > >> > What does the error message say, again? >> > >> > Cheers >> > -- >> > t >> > >> > >> "Lisp error: (void-function local-define-key)" for "Emacs 27.2". >> That function does not exist. >> > > Well, that's clear enough, isn't it? Do you think a function > by that name should exist? If yes, why do you think that? If > no, what is your problem? > > Cheers > -- > t > Eli mentioned it, but is was a mistake. The problem is that I discovered "common-lisp-mode" but there is no "common-lisp-mode-map". ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 19:08 ` wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-31 12:11 ` Alessandro Bertulli 0 siblings, 0 replies; 17+ messages in thread From: Alessandro Bertulli @ 2022-08-31 12:11 UTC (permalink / raw) To: wilnerthomas; +Cc: tomas, help-gnu-emacs wilnerthomas--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes: > Eli mentioned it, but is was a mistake. The problem is that I discovered > "common-lisp-mode" but there is no "common-lisp-mode-map". I don't know if this can help, but usually when I encounter these errors I do a `M-x grep-find`. For instance, looking in /usr/share/emacs/29.0.50/lisp/, with find . -type f -exec grep --color=auto --include=*.el -nH --null -e \ common-lisp-mode-map \{\} + I found ;; Used in old LispM code. (defalias 'common-lisp-mode 'lisp-mode) So, maybe it is correct that common-lisp-mode-map doesn't exist, as you should use lisp-mode-map? Alessandro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 14:15 ` uzibalqa 2022-08-30 15:25 ` tomas @ 2022-08-30 16:24 ` Eli Zaretskii 1 sibling, 0 replies; 17+ messages in thread From: Eli Zaretskii @ 2022-08-30 16:24 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 30 Aug 2022 14:15:51 +0000 > From: uzibalqa <uzibalqa@proton.me> > Cc: help-gnu-emacs@gnu.org > > > > Have got "Lisp error: (void-function local-define-key)" for "Emacs 27.2". > > > > > > 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. > > What can be the origin of the Lisp Error? That function doesn't exist. I missed the fact that you used a wrong name in the original question, sorry. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 13:49 ` Eli Zaretskii 2022-08-30 14:15 ` uzibalqa @ 2022-08-31 12:04 ` Alessandro Bertulli 2022-08-31 12:42 ` Eli Zaretskii 1 sibling, 1 reply; 17+ messages in thread From: Alessandro Bertulli @ 2022-08-31 12:04 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs 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. 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? Alessandro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-31 12:04 ` Alessandro Bertulli @ 2022-08-31 12:42 ` Eli Zaretskii 2022-09-01 9:27 ` Alessandro Bertulli 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2022-08-31 12:42 UTC (permalink / raw) To: help-gnu-emacs > 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-31 12:42 ` Eli Zaretskii @ 2022-09-01 9:27 ` Alessandro Bertulli 0 siblings, 0 replies; 17+ messages in thread From: Alessandro Bertulli @ 2022-09-01 9:27 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs Eli Zaretskii <eliz@gnu.org> writes: > 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). You're right, and as a matter of fact, from the doctring I cannot see when that advice was introduced. > 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. Thanks, that's something I can use too. Usually I use define-key because I'm setting my init file, and I know (almost everytime) which mode I'm customizing. Anyway, your suggestion is super useful. Thanks! Alessandro ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: define-key upon common-lisp-mode and inferior-lisp-mode 2022-08-30 4:59 define-key upon common-lisp-mode and inferior-lisp-mode wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 11:44 ` Eli Zaretskii @ 2022-08-30 13:24 ` Stefan Monnier via Users list for the GNU Emacs text editor 1 sibling, 0 replies; 17+ messages in thread From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-08-30 13:24 UTC (permalink / raw) To: help-gnu-emacs > Have encountered "common-lisp-mode" but there does not exist > "common-lisp-mode-map". On my machine, `C-h o common-lisp-mode RET` tells me: common-lisp-mode is an alias for ‘lisp-mode’ in ‘lisp-mode.el’. > Also seen "inferior-lisp-mode-map". which has no associated > "inferior-lisp-mode". Really? They're both defined in the same `inf-lisp.el` file. AFAIK it's a mode that used to be used for a buffer containing common-lisp REPL running in a subprocess. I suspect nowadays people use Slime or SLY which I expect don't use `inf-lisp.el` any more. Then again, I thought `lisp-mode` wasn't used by those modes either but I was proved wrong, so maybe they do still use `inferior-lisp-mode` as well? Stefan ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-09-01 9:27 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-30 4:59 define-key upon common-lisp-mode and inferior-lisp-mode wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 11:44 ` Eli Zaretskii 2022-08-30 12:26 ` uzibalqa 2022-08-30 12:51 ` Eli Zaretskii 2022-08-30 13:22 ` uzibalqa 2022-08-30 13:49 ` Eli Zaretskii 2022-08-30 14:15 ` uzibalqa 2022-08-30 15:25 ` tomas 2022-08-30 18:21 ` wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-30 18:41 ` tomas 2022-08-30 19:08 ` wilnerthomas--- via Users list for the GNU Emacs text editor 2022-08-31 12:11 ` Alessandro Bertulli 2022-08-30 16:24 ` Eli Zaretskii 2022-08-31 12:04 ` Alessandro Bertulli 2022-08-31 12:42 ` Eli Zaretskii 2022-09-01 9:27 ` Alessandro Bertulli 2022-08-30 13:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).