Skip to main content
Share Your Experience: Take the 2024 Developer Survey
10 votes
Accepted

What does `(fset SYMBOL KEYMAP)` do?

fset sets a symbol's function definition. Here, projectile-command-map is used as a prefix command. A prefix command is a symbol whose function definition is a keymap. The definition of a prefix ...
Tianxiang Xiong's user avatar
9 votes
Accepted

What is the difference between C-x and C-c and the concept behind it?

The normal C-x keymap is for global bindings which are expected to do something regardless of the active modes. Conversely: Sequences consisting of ‘C-c’ followed by a control character or a digit ...
phils's user avatar
  • 51.5k
6 votes
Accepted

Proper way to change prefix key for minor-mode map?

It depends on the minor-mode/package. Many make this more configurable, which doesn't seem to be true in this case. I think the simplest thing here would be to just redefine the keymap yourself ...
justbur's user avatar
  • 1,510
6 votes
Accepted

Find out the purpose of a Prefix Command listed in describe-bindings

In most cases, you can type the prefix and then C-h to get a list of all the bindings that begin with that prefix. This won't directly tell you what the prefix means and not all prefixes have a ...
MAP's user avatar
  • 592
5 votes
Accepted

C-) not recognized on Windows 10

I found a solution—the following works for me: Control Panel > Language > Advanced Settings > Change language bar hot keys > Ensure Between input languages is highlighted > Change Key Sequence... ...
achalk's user avatar
  • 589
5 votes
Accepted

What is the difference between global-set-key and local-set-key?

The short answer: If you wish the prefix to be present in all buffers and all modes, use global-set-key. If you wish it to be present only in one mode, use local-set-key. The difference between the ...
Harald Hanche-Olsen's user avatar
4 votes
Accepted

How to make emacs recognise C + SHIFT combinations in terminal mode?

You can't. There's no way for a terminal to communicate both control and shift modifiers. The very original terminals (teletypes, actually) implemented the control modifier by masking out the top two ...
db48x's user avatar
  • 18.2k
4 votes
Accepted

When does Emacs treat keymaps as functions?

There's nothing new or unusual about this. This is how prefix keys work. They are bound to a keymap -- or they are bound to a symbol whose value or whose function definition is a keymap. The Elisp ...
Drew's user avatar
  • 77.9k
4 votes

how to add a prefix key to all keybindings of a specific mode?

One way to move -mode's keybindings could be with something like (let ((origmap <foo>-mode-map) (newmap (make-sparse-keymap))) (define-key newmap <prefix> origmap) (setq <foo&...
Stefan's user avatar
  • 26.5k
4 votes
Accepted

How do I add a keybinding to use during an interactive isearch, `C-s ...`

As I understand your question, you want C-s to start an interactive search, as it normally does, but if you press C-w after you've started that search, you want it to switch to isearch-symbol-at-point....
Tyler's user avatar
  • 22.3k
4 votes
Accepted

Stop major modes from overwriting my keybinding

You should steal the technique used by bind-key*. Basically, the bindings in minor modes take precedence over major modes, and minor modes in the emulation-mode-map-alists take über precedence. ...
Oliver Taylor's user avatar
3 votes

Change prefix key for compose-character (C-x 8)

Personally I use the Multi_key (sometimes called the "compose" key) under X11, which I have mapped to the right Alt key. That works everywhere rather than only in Emacs.
Stefan's user avatar
  • 26.5k
3 votes
Accepted

make local map bindings available through a global prefix

Based on the clarifications to the question, something like this might do the trick? (defvar my-leader-map (make-sparse-keymap) "Prefix binding for custom things.") (global-set-key (kbd "M-SPC") ...
phils's user avatar
  • 51.5k
3 votes

What's wrong with my tab key?

It has become a prefix key, meaning it starts a sequence of keys the way C-x does. Try typing TAB C-h to see what keymap it is a prefix for. Edit: Now that we can see that the keymap assigned to TAB ...
db48x's user avatar
  • 18.2k
3 votes
Accepted

Diacritic marks in emacs for macOS

But on macs keyboard it is no distinction between left and right option key ⌥ as it is in Win (Alt and Alt+Gr). Yes, there is. You have the variables ns-alternate-modifier and ns-right-alternate-...
d125q's user avatar
  • 1,443
3 votes

How do I learn which key prefix a keymap is bound to?

Looking at the definition of define-prefix-command we find that a prefix is created by assigning the map to the function cell of a symbol (via fset). From this, we conclude that a prefix is actually a ...
dalanicolai's user avatar
  • 7,855
2 votes

how to add a prefix key to all keybindings of a specific mode?

Define a prefix key for the mode's keymap. Undefine the other keys that bother you, from that keymap. Suppose that mode foo-mode binds key C-x o to foo-it, and you don't like that. (define-key foo-...
Drew's user avatar
  • 77.9k
2 votes
Accepted

Bind function to the prefix key of Workgroups2

One way to do it is, instead of binding C-c z to a prefix key, bind it to a command that displays what you want and then calls set-transient-map to read a key sequence and interpret it in another map. ...
Gilles 'SO- stop being evil''s user avatar
2 votes

What packages are available for modal editing?

Meow A new modal editing package which borrows ideas from Kakoune, modalka and god-mode. Desgin Principles Meow has four modes, INSERT, NORMAL, MOTION, KEYPAD. Almost no default keybinding, Meow ...
2 votes

Find out the purpose of a Prefix Command listed in describe-bindings

The first answer is that its purpose is to act as a prefix key to the keys that follow it; that is, to serve as a keymap for a certain number of key bindings. Those bindings are also shown in describe-...
Drew's user avatar
  • 77.9k
2 votes

Binding <ESC> <ESC> to have <ESC> <ESC> <ESC> functionality

This binding is in the global keymap. Generally key bindings that work in most or all buffers are in the global keymap. If in doubt, see How can I find out in which keymap a key is bound? to check. ...
Gilles 'SO- stop being evil''s user avatar
2 votes
Accepted

How can I redefine a key that is currently used as the start of a key sequence?

By default, evil binds C-w to the evil-window-map, within which it stores the rest of the keybindings. In looking at the source code, the core spot it happens is in evil-motion-state-map. Depending ...
Dan's user avatar
  • 33.1k
2 votes
Accepted

Relocating an anonymous prefix keymap

It looks like the answer is yes, you are right. And there is no cleaner way to deal with it - but see below, for one suggestion. I'd suggest filing an enhancement request that Emacs add a variable ...
Drew's user avatar
  • 77.9k
2 votes
Accepted

Normal C-c in ansi-term

Substitute the key you prefer for C-c in the following call to term-set-escape-char in order to change the value of term-escape-char to some other key, and then unbind C-c from the term-char-mode ...
phils's user avatar
  • 51.5k
2 votes
Accepted

Binding a key to (MAP . CHAR)?

(define-prefix-command 'my-temp-map) (Or (fset 'my-temp-map my-temp-map), since you've already created the sparse keymap.) The point is that you need to not only create the keymap for the prefix key....
Drew's user avatar
  • 77.9k
2 votes

Rebind just `C-c` to some command

That is not so easy, because C-c is a general prefix key in Emacs. Here is a hacky way to achieve that, don't know if there are better options: (add-hook 'eshell-mode-hook 'my-hacky-C-c-remap) (...
clemera's user avatar
  • 3,486
2 votes
Accepted

Change prefix key for compose-character (C-x 8)

I'm no expert on this, and this might not be the right way to do it, but I think this will do it for you: (define-key global-map (kbd "M-'") iso-transl-ctl-x-8-map))) iso-transl-ctl-x-8-map is a ...
Drew's user avatar
  • 77.9k
2 votes

Spacemacs redefine main prefix `M-m`

There are settings for the leader key in your .spacemacs file. I have remapped mine to Page Up, (which is represented as <prior> by emacs). Here's what I have in my .spacemacs: ;; The leader ...
shoshin's user avatar
  • 914
2 votes
Accepted

macOS not-terminal: why "S-" is translated away from S-RET?

You didn't show us how you're attempting to bind S-RET, but one way is: (local-set-key (kbd "S-<return>") (lambda () (interactive) (message "hello")))
rpluim's user avatar
  • 5,315
2 votes

What does it mean to type the "at" symbol in `C-c @ C-h`?

I'm familiar with C-c and with C-h, but I can't figure out what the @ means. It's the literal character @ for which your keyboard should have a key (or key sequence). On my keyboard @ is Shift+2. ...
phils's user avatar
  • 51.5k

Only top scored, non community-wiki answers of a minimum length are eligible