Questions tagged [key-bindings]
Keyboard shortcuts, key chords, key sequences, hotkeys, or any association between key combinations and corresponding actions in Emacs.
1,401
questions
0
votes
0
answers
36
views
How to bind Windows key in Emacs on FreeBSD
How do I bind the Windows key to a function in Emacs 29.1 on FreeBSD
0
votes
0
answers
40
views
Minibuffer and ido keybindings with ergoemacs-mode
I'm struggling to get the same hotkeys in the latest ergoemacs-mode (as they were in ergoemacs 5.3.7):
In the M-x (execute-extended-command) command prompt I want M-i to act as previous-line-or-...
0
votes
1
answer
48
views
How add Evil keybindings to Magit, without removing all Magit prefix-keys
In magit status of a Git repository, you usually press f u to fetch from upstream (these keybindings in Magit will call magit-fetch-from-upstream).
With Magit keybindings I have noticed the letters ...
2
votes
1
answer
61
views
Configuring Key-bindings from Org-Table
I use init.org file to configure my emacs, and then tangle it into init.el.
Now, I would like to configure my keybindings from org-table (for more readable and printable).
Basically, I'd like to only ...
0
votes
1
answer
20
views
query-replace, add a "skip to next" in lambda function
I have this function:
(defun fix-mult-punct-before-footnote ()
"Scope: FOOTNOTE
Description: Fixes repeated/multiple punctuation before the \\footnote macro."
(interactive)
;; "..\...
0
votes
1
answer
24
views
Safe way to rebind a key for only the duration of a function
I am working on some code that does keyboard macros and minibuffer recursive edits. As a result, sometimes you need to exit a macro's recursive edit before the minibuffer. This can be confusing for ...
0
votes
1
answer
60
views
How do I assign Ctrl-C Ctrl-D to menu Python/Debugger in my ~/.emacs file?
With a .py file open in my buffer, and the major mode being Python, there is a menu called Python. There is a item in it called Debugger. It has no associated keyboard shortcut.
What is the lisp ...
0
votes
2
answers
38
views
Emacs calling unbound key sequence `C-c @` a "non-prefix key" [closed]
Emacs won't let me bind C-c @ TAB to outline-cycle in outline-minor-mode. It complains "Lisp error: (error "Key sequence C-c @ TAB starts with non-prefix key C-c @") -- but C-c @ is ...
0
votes
1
answer
66
views
Why doesn't my key binding work?
I tried adding this code to interactively clear the echo area (or mini-buffer not sure??) during Vertico's find-file.
(defun my-kill-line ()
"Remove text from the echo area by killing backwards&...
1
vote
0
answers
54
views
Why can't I ignore the right Meta key in Emacs 29.1 on MacOS?
I'm using GNU Emacs for MacOSX 29.1 under macOS Ventura, & I need to enter accented letters (é, à, &c.). Following the manual, wiki, & several articles, I used
(setq ns-alternate-modifier '...
0
votes
1
answer
48
views
How can an interactive function detect that it is invoked via an hydra?
Assume there's an interactive function foo. Assume it is bound in various keymaps and is also bound inside an hydra as a simple key, let's say "a".
How can foo's code detect that it was ...
0
votes
1
answer
64
views
Why does Emacs when started with 'no window' delete a character when I press C-h?
I've recently started to see the following behavior: when I run Emacs via emacs -nw -Q, and hit C-h, it runs BACKSPACE, deleting the characters.
But if I run the same Emacs version in GUI mode, that ...
0
votes
0
answers
50
views
Rebinding navigation keys when using isearch
I've rebound most of my navigation keys using bind-keys* and am trying to create a uniform layout. But I have the problem that when I trigger isearch, point is not actually placed in the minibuffer ...
3
votes
3
answers
153
views
Binding a key in another package's yet undefined map in use-package?
I'm using use-package for my configuration in init.el.
How can I bind a key to a map that has not yet been defined?
As a specific example, I'm using the following configuration of
(use-package latex-...
0
votes
0
answers
39
views
Key sequences that are translated to ESC
I understand from the FAQ that Escape is supposed to be the same as C-[: https://www.gnu.org/software/emacs/manual/html_node/efaq/Basic-keys.html
However, I could rebind C-[ without any problems ...
2
votes
2
answers
99
views
Rebinding RET without rebinding <kp-enter>
My Emacs translates C-m as RET like here: https://stackoverflow.com/questions/7235381/unbind-c-m-from-ret. I'd like to use C-m though, and I have a multilevel keyboard-layout in which <kp-enter> ...
0
votes
1
answer
48
views
Changing key binding definitions
I read somewhere that emacs v29.1 has changed the way that you can define key bindings...
ie previously you would write:-
(global-set-key (kbd "<f2>") 'save-buffer)
now you can write:-...
1
vote
2
answers
51
views
How to create a general and specific key binding
How do I bind a key for general use, but differently for a specific mode, such as dired?
eg how would I resolve this?
(define-key dired-mode-map (kbd F12) #'dired-up-directory)
(global-set-key (kbd ...
0
votes
2
answers
54
views
Using TAB to flip between two windows
I have set TAB to flip between two windows using:-
(global-set-key (kbd "TAB") 'other-window)
This works sometimes, but not always. How should I define it?
0
votes
1
answer
37
views
Bind LEFT to goto parent directory in dired mode
How do I bind the LEFT key to go to parent directory in dired mode?
I tried
(define-key dired-mode-map (kbd "<left>") #'dired-up-directory)
but that didn't work.
1
vote
1
answer
110
views
Why does BACKSPACE generate C-h?
When running emacs (v29.1) -nw on a ThinkPad X61 under FreeBSD 13.2, pressing Backspace generates C-h. The key is not bound to anything.
Running C-h k BACKSPACE does not show DEL but C-h-h. Entering ...
0
votes
1
answer
45
views
AucTeX: Keybinding for compiling document
Is there a command, for which I can set a keybind for compiling the document? The command (TeX-command-master, bound to C-c C-c) gives you a list of options but it's rather inefficient. I'm looking ...
0
votes
1
answer
53
views
Corfu: Why does <tab> shows a corfu popup?
I have this configuration:
(setq tab-always-indent 'complete)
(global-corfu-mode 1)
Nothing else should have grabbed the <tab> key. When I do C-h k, then <tab>, I get that it is bould to ...
0
votes
0
answers
21
views
How to see if a keybinding is used in any mode? [duplicate]
For example, I once set <C-j> as <C-x>, only to find out <C-j> is used for org-forward-heading-same-level in org-mode.
I know <C-h> k shows a keybinding's usage in current mode....
1
vote
1
answer
57
views
Confusion about key definition for SPC
Yesterday, I tried to do something like
(define-keymap " " #'foo)
and I got the error message that " " is not a valid key definition. OK, key-valid-p also says so and I figured ...
0
votes
0
answers
49
views
A better where-is command?
I'm trying to setup a way to find keys I want to use but keep forgetting.
(I know there is where-is (C-w) and describe-binds, describe-mode. )
I want the following,
initiate a command to search for ...
0
votes
1
answer
43
views
How to bind dired-up-directory to key
I'm tryng to bind F6 to dired-up-directory using
(global-set-key (kbd "<f6>")
but when I use this in dired-mode, I get
<f6> is undefined.
What have I done wrong?
2
votes
1
answer
47
views
use keymap-set to bind to string
I used to use global-set-key to bind a key sequence to a string:
(global-set-key (kbd "<f9> a") "text")
Now in v29.1, C-h f global-set-key:
This is a legacy function; see ...
0
votes
1
answer
23
views
How to Stop Mouse Click in Echo Area from Opening Message Buffer?
Clicking the echo area causes Emacs to switch to the *Messages* buffer.
I hate this behavior, because the only time I click the echo area is on accident, whereupon it wastes time and breaks train of ...
0
votes
1
answer
36
views
keybinding which will respect minor mode override
I am trying evil mode and want to keep emacs's C-k when in insert mode.
C-k is kill-line
but when smartparens-mode is on, it's
sp-kill-hybrid-sexp
So I can't just bind C-k to kill-line in evil-insert-...
0
votes
0
answers
19
views
make smartparens not to override python bindings
with smartparens turned on, C-M-a becomes sp-backward-down-sexp
I think python-mode's beginning-of-defun is more useful.
How I can setup so that
python-mode's keybinding is not overriden by ...
1
vote
2
answers
64
views
Difference between emacs and emacs --load ./init.el
I have the init.el file with following configuration:
(require 'package)
(add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives '(&...
0
votes
0
answers
21
views
Copying nvmap-defined keybindings to emacs-state using a different prefix key
I use general.el to define keybindings. For evil-mode, I've use nvmap, using something like the following:
(nvmap :keymaps 'override :prefix "SPC" :global-prefix "M-SPC"
&...
0
votes
1
answer
51
views
how to find out which key is free to use in a specific mode-map?
Suppose I'd like to add a custom key bind to a certain mode map.
I don't want to override an existing key accidently.
How can I find out which keys are free to use for a mode-map?
The best way I can ...
0
votes
1
answer
31
views
How to translate C-i to F8
I have tried the following:
(keyboard-translate ?\C-I (kbd "<f8>"))
(keyboard-translate ?\C-I [(f8)])
The representation of F8 key is wrong.
0
votes
2
answers
49
views
How can I bind Option+up-arrow to scrolling command?
I'm on a Mac, using iTerm2. 'Option' is the same as Alt, and Alt is Meta in emacs.
First, in emacs I typed C-h k followed by Option-Up (Hold option key and press up arrow). The output was
ESC <up&...
1
vote
1
answer
48
views
Override counsel-yank-pop binding with use-package
I would like to use the classic emacs yank-pop instead of counsel mode's counsel-yank-pop which is linked to M-y. I've tried unbinding and rebinding it, but it does not seem to work.
I setup counsel ...
1
vote
1
answer
227
views
Why does emacs-29 translates meta to meta+hyper ("M-somekey" to "H-M-somekey")?
With emacs 28 everything worked fine. After installing emacs-29 I see the following: for example typing "Meta + w" creates "H-M-w" which is undefined. With emacs-28 I got "M-w ...
0
votes
1
answer
32
views
Keybinding breaks undo-tree with evil
A few months ago I noticed undo-tree was not working properly for me, though it had never been a problem in the past. Whenever I opened an existing file on my computer and edited it, trying to undo ...
0
votes
2
answers
53
views
Disable the `tabbar-mode` globally and erase everything related to it, in particular - the key bindings
I'd like tabbar-mode to be forbidden in my Emacs setup; in particular, I'd like all the related C-x t-prefixed bindings to be erased. Is that possible in a plain vanilla Emacs of the latest stable ...
0
votes
0
answers
31
views
How can I bind C-M-g to wg-prefix-key?
I'm able to bind C-c w to wg-prefix-key
(setq wg-prefix-key (kbd "C-c w"))
, but not C-M-g
(setq wg-prefix-key (kbd "C-M-g"))
It says:
[134217735]
, in the Echo Area when I ...
0
votes
1
answer
32
views
Strings in menu cons
I am making a topmenu named MCP with a submenu named Daphne.
;; Topmenu MCP
(define-key-after global-map
[menu-bar mcp-menu]
(cons "MCP" (make-sparse-keymap "MCP")) 'Tools)
...
1
vote
1
answer
124
views
Key binding to set specific property value in PROPERTIES drawer
I store a property MyValue, in property drawers for a lot of headlines and need to update it regularly.
Instead of typing C-c C-x p MyValue 0 <RET> on each heading, I would like to have a custom ...
2
votes
1
answer
46
views
Key binding to generate a sparse tree from the kill-ring
I want to set a key binding that creates a sparse tree of all headlines containing the string currently on the kill-ring.
Currently, I mark the text I want and save it to the kill-ring, then call org-...
0
votes
1
answer
29
views
Making certain key sequences show up in the lighter menu [duplicate]
With the following code, how can I get H-b, H-m, H-w, H-v, to show up in the lighter menu ?
(defvar tika-kymap
(let ((pfmap (make-sparse-keymap)))
(keymap-set pfmap "H-b" #'outline-...
0
votes
1
answer
68
views
Menu showing outline key sequences
I am using easy menu with a keymap, but instead of seeing H-b, H-m, H-w, H-v, I still get C-c @ C-t, C-c @ C-c, C-c @ C-e, C-c @ C-a, when clicking upon the minor mode lighter.
(defvar tika-kymap
(...
-2
votes
1
answer
44
views
Adding separators between menu items
Have made the following KMAP keymap, and would like to add separators in the menu. To separate the Hide keymap from the Show keymap. How can I do it?
(defvar tika-outlmenu-kmap
(let ((kmap (make-...
0
votes
1
answer
34
views
Creating Bindings for Rectangle Mark Mode Doesn't Work
I want to create bindings for rectangle-mark-mode though the methods described above haven't worked for me.
I've tried using an alist that I thought it possessed, but Emacs returned a bug saying its ...
0
votes
0
answers
29
views
org-meta-up, on normal text
I've found the move-text package, which does what I want; moving lines up and down with M-UP.
This however, is the same keybinding as org-meta-up, which moves org-headings up and down.
I don't want to ...
0
votes
2
answers
81
views
How can I use a key to toggle between line mode and char mode in ansi-term?
Emacs 27.1
I run ansi-term and very often change mode from line to char mode and visa versa.
I do this by mouse click. It's not very convenient. How can I do it with a key binding?