A control-modified letter character still results in a character, and hence character translation works for those; but most other modified keys do not result in a character.
Both are represented as integers, but there's a limit to the ints which are valid for characterp. See the following for details:
You cannot really change the C-[ binding at user-level
you would do with global-set-key. However, you can change it as
a keyboard event before it reaches those keymaps. You can say for example:
and then use [control-bracketleft] in your keymaps. Pretty simple isn't it?
Substrings in the kbd argument that are delimited by < and > are labels for non-character input events such as <mouse-2>. But, with [ you mean the character [ and with M- you mean the meta modifier. So < and > are inappropriate in your use-case.
Use (kbd "M-[") instead of (kbd "<M-[>").
For historical reasons, Emacs supports key bindings for the 'super' and 'hyper' modifier keys, which you probably do not have on your keyboard. See Modifier Keys in the Emacs manual for more information.
So the key bindings you are looking at use super+l as a prefix.
You can simulate these additional keys with some built-it sequences:
C-x @ h adds the ...
You could use a transient key map to do this:
(defun my-fun ()
(let ((mes "Important data")
(define-key map "j" (lambda () (interactive) (insert mes)))
Here, I define a new keymap map, and give it a single binding for the key j. After I display the ...
Key naming is messier than it ought to be. When you press the Tab key while the Shift modifier is held down, your operating system tells Emacs that you've pressed the ISO_Left_Tab key. I guess that you're using an X11-based system (I think that's the only platform with this particular key name) and you're using a standard XKB layout which specifies (e.g. ...
There is a common convention that a numeric prefix argument means “do it this many times”. If a command follows this convention, a prefix argument of 0 is useless. However, not all commands follow this convention or the other common convention of having two behaviors, one with no argument and one with a prefix argument other than 1.
For example, save-buffer ...
Add at least one additional definition:
(global-set-key (kbd "C-i") 'universal-argument)
(define-key universal-argument-map (kbd "C-i") 'universal-argument-more)
See additional universal-... definitions in both bindings.el and simple.el that may be rebound if so desired.
I have the command fill-paragraph mapped to key <escape> q, it is mapped by default in emacs.
In fact, it's mapped to ESC q by default, which is slightly different. ESC is the ascii escape character, while <escape> is the keyboard key at top left of your keyboard (but if you're using Emacs from a text terminal, the terminal probably sends ESC, ...
You can simply map the keys - and _ to do what you want in python mode:
(defun insert-underscore ()
(defun insert-hyphen ()
"You know it!"
(defun python-remap-hyphen-and-underscore ()
(define-key python-mode-map "-" 'insert-underscore)
(define-key python-mode-map "_" '...
Let us have a short look at the implementation of make-composed-keymap (in Emacs 26.3):
(defun make-composed-keymap (maps &optional parent)
,@(if (keymapp maps) (list maps) maps)
The list maps is spliced in.
When called with two maps and one parent you get a list (keymap (keymap el11 ... el1A) (keymap el21 ... ...
You can define your own function that does all the things you want it to do and bind it to a key:
(defun my-day-page ()
(org-agenda-list nil nil 1 nil)
(define-key global-map [f10] 'my-day-page)
See the doc for org-agenda-list (C-h f org-agenda-list RET) for the meaning of the arguments: the third argument (the ...
Ctrl+/ has the same effect as BackSpace because your terminal tells Emacs that you pressed Backspace: it sends DEL for Ctrl+/. There's no character for C-/ and most terminals don't have a control sequence for it, so there's no chance that Emacs would see C-/. You need to reconfigure the terminal to either send a different escape sequence that you bind to ...
If an input event is not bound and contains the Shift modifier or is an uppercase character, Emacs converts it to the corresponding unshifted or lowercase event. This is discreetly documented in the Emacs Lisp manual under read-key-sequence. Unlike what the docstring of read-key-sequence says, this isn't limited to the first event in a sequence: if KEY1 is ...
ASCII control character Control M is a carriage-return character. It is return, and its ASCII name is RET. That's the reason why C-m in Emacs is RET.
In terminal mode (no graphic display) Emacs does not have a <return> (pseudo-)function key. There is only the RET key, also known as C-m.
In a graphic-display Emacs has both a <return> key and a ...
You can use a transient map for this. A transient map is a keymap that is only active for a single keypress, and lets keys not in the keymap "fall through", and do their normal behavior.
This code inserts "command2" when command2 is run. When command1 is run, it prints a message into the minibuffer. Then, if you press j, it calls command2. If you instead ...
@gilles and @npostavs have given use cases. To summarize what they said:
When you're already using C- or M- for part of a key sequence, it can be easier to specify a zero prefix arg using C-0 or M-0 than using, say, C-u 0.
A zero numeric prefix arg can have a specific (not necessarily numeric) meaning for a given command. @Gilles mentioned save-buffer, ...
Following from the excellent comment by @daveloyall, here's the key
quote from the Commentary of vi-dot.el by Will Mengarini (circa
March 1998, before vi-dot was renamed to repeat). This is from
Since the whole point of vi-dot is to let you repeat commands that are
bound to multiple keystrokes by leaning on a single key, ...
You need to use L rather than S-l.
This is a quirk of key sequences in Emacs -- for letters (a-z), the shift modifier syntax S- won't do what you want, unless C- is also used in the sequence.
You should therefore write upper-case letters explicitly in key sequences.
See also https://stackoverflow.com/q/38180797/324105
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.
First off, the feature you're after is almost the same as the default behaviour bound to C-s C-M-w. That will call isearch-yank-symbol-or-char, which is ...
M-| (M-x shell-command-on-region) runs a shell command using the region as stdin, display the output in the echo area, with a prefix arg, replace the region with the output.
Unlike your shell in a terminal, each use of M-! or M-|: start a shell such as bash, run the shell command, then kill the shell. And the region is data passed to the shell command, the ...
There are several things wrong with the code:
You need #', (or just ',) in front of func. Inside a backquote expression, just func would result in the literal symbol func, not its value as a variable. Use comma (, to evaluate it. But then quote that evaluated result.
You need to use kbd, or else you are trying to bind the key sequence C-x SPC k.
You need ...
For me the C-down-mouse-1 solution worked, but still used the point from before the click. Thus I use now:
(define-key c-mode-base-map [C-down-mouse-1] 'mouse-drag-region)
(define-key c-mode-base-map [C-mouse-1] 'rtags-find-symbol-at-point)
so now, first the point gets set, then we find the correct symbol.
I cannot think any use case...
It just makes entering numeric prefix arguments a little easier. For example, with numeric argument of 0, C-k (kill-line) will delete from point to the beginning of line. You can invoke this with C-0 C-k which is easier than typing C-u 0 C-k.
buffer-invisibility-spec is a buffer local variable.
If you want globally set the key you must add a to the default value of buffer-invisible-spec.
global-set-key is a function therefore the argument (add-text-properties ...) is evaluated before global-set-key. The return value of add-text-properties is undefined in the doc. So you bind your keys to some ...
In the comments we established that the problem wasn't the code shown in the question:
(local-set-key (kbd "<C-return>") 'magit-diff-visit-file-other-window)))
The problem was the use of this pattern:
(add-hook 'HOOK (lambda ...))
When that pattern is used, updating the code of that (lambda...) ...
I think you are looking for this:
(define-key ess-extra-map "r" nil)
(define-key ess-extra-map (kbd "C-c C-e r") nil)
C-c C-e is bound to a keymap. In that keymap, r is bound to inferior-ess-reload.