* Keybinding excluding specific modes
@ 2022-08-29 20:37 uzibalqa
2022-08-29 21:24 ` wilnerthomas--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 3+ messages in thread
From: uzibalqa @ 2022-08-29 20:37 UTC (permalink / raw)
To: uzibalqa via Users list for the GNU Emacs text editor
Whilst I can set a keybinding according to mode (e.g. emacs-lisp-mode-map)
(define-key emacs-lisp-mode-map (kbd "H-e") #'eval-last-sexp)
how can I use the same key combination for eval-last-sexp when not in lisp type modes?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Keybinding excluding specific modes
2022-08-29 20:37 Keybinding excluding specific modes uzibalqa
@ 2022-08-29 21:24 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-29 23:13 ` Michael Heerdegen
0 siblings, 1 reply; 3+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-29 21:24 UTC (permalink / raw)
To: uzibalqa; +Cc: uzibalqa via Users list for the GNU Emacs text editor
Aug 29, 2022, 20:37 by uzibalqa@proton.me:
>
> Whilst I can set a keybinding according to mode (e.g. emacs-lisp-mode-map)
>
> (define-key emacs-lisp-mode-map (kbd "H-e") #'eval-last-sexp)
>
> how can I use the same key combination for eval-last-sexp when not in lisp type modes?
>
One thing I could do is this
(global-set-key (kbd "H-e") #'eval-expression)
(define-key lisp-mode-map (kbd "H-e") #'eval-last-sexp)
(define-key emacs-lisp-mode-map (kbd "H-e") #'eval-last-sexp)
Because local key maps override the global ones. I define one key in the global map and then override the key sequence with a key binding in lisp-mode-map and emacs-lisp-mode-map.
Would this be all?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Keybinding excluding specific modes
2022-08-29 21:24 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-29 23:13 ` Michael Heerdegen
0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2022-08-29 23:13 UTC (permalink / raw)
To: help-gnu-emacs
wilnerthomas--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Would this be all?
As far as I understand your question: yes, that's all.
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-29 23:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-29 20:37 Keybinding excluding specific modes uzibalqa
2022-08-29 21:24 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-29 23:13 ` Michael Heerdegen
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).