Questions tagged [key-bindings]

Keyboard shortcuts, key chords, key sequences, hotkeys, or any association between key combinations and corresponding actions in Emacs.

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

Unable to bind square brackets to functions

I'm trying to bind M-[ and M-] to the following functions (courtesy of Xah Lee): (defun xah-forward-block (&optional n) "Move cursor beginning of next text block. A text block is separated by ...
2
votes
1answer
28 views

What's the idiomatic way of overriding a key binding for a given major-mode (but no other)?

I'd like to bind C-x C-e to python-shell-send-region when I am in python major-mode. In my config file, I have an add-hook for python mode, but I'd like this keybinding override to be removed/...
3
votes
2answers
322 views

Swap M-x and M-q

How can I swap M-x and M-q? I can swap C-x and C-q with ;; swap C-q and C-x (keyboard-translate ?\C-q ?\C-x) (keyboard-translate ?\C-x ?\C-q) The following errors out (keyboard-translate ?\M-q ?\...
1
vote
1answer
27 views

shift selection not working for rebound M-{ backward-paragraph

I slightly simplified the keys for backward-paragraph and forward-paragraph: (global-unset-key (kbd "M-{")) ;; originally backward-paragraph (global-unset-key (kbd "M-}")) ;; originally forward-...
4
votes
1answer
50 views

Specifying a binding for control shift tab?

I defined a function like this: (defun switch-to-prev-window () (interactive) (other-window -1)) and it appears to work if I call it with M-x. But I've added the binding (global-set-key [(...
0
votes
3answers
24 views

Swap Shift/non-shift key behavior for particular mode

I want to press - on my keyboard and have _ be inserted and vice-versa only for a particular mode. The following does this globally using the post-self-insert-hook, It checks the character just ...
0
votes
0answers
12 views

key bindings for Interrupting and then re-executing previous command

I want a keyboard shortcut (binding) that can step 1) interrupt the foreground process (/C-c) step 2) re-execute the previous process in history (/C-p/C-m) But i am not able to do it, probably ...
0
votes
1answer
57 views

What does z originate in C-x z (z no relation with repeat literally

In contract to vim's arbitrary behaviors in choosing keys, emacs's key binding performs semantically, C-x (C for commands, x for execute) M-x (M for meta commands or named command, invoke a ...
0
votes
1answer
48 views

C-x C-q wants to quit Emacs

I want to use C-x C-q to make the Dired buffer editable, however, this key combination seems to be bound to quitting Emacs for some reason. I did not bind this key combination somewhere in my config. ...
0
votes
1answer
20 views

How to get rid of ido-find-file

I have recently switched from obsolete ibuffer-mode to ido mode, and it replaced C-x C-f command to ido-find-file with completions. I don't need it. How to revert it back to simple find-file? I tried ...
0
votes
0answers
21 views

Emacs LISP keyboard bindings with OSX and iMac keyboard?

Does anyone know how to change Mac OSX keybindings quickly for use with Emacs? I'm hoping to redefine at least the following keys: iMac KB Key -> Keycode on MacOSX CAPS LOCK -> ...
0
votes
0answers
12 views

Bind chord key to another key

How would I map chord to behave similar to another keybinding? The reason is because C-h c C-g gives me different functions whether I am minibuffer or buffer. (use-package use-package-chords :...
0
votes
1answer
19 views

Emacs keybindings / invocation for Apple iMac keyboard, similar to LMI or Knight?

Does anyone have a HOWTO on creating efficient keybindings and invocation of Emacs for the iMac Bluetooth keyboard pictured here? Specifically one or more of the following use cases: Invocation of ...
1
vote
1answer
54 views

Commands with Keybindings only

When I run helm-M-x and enter characters, I like to see only those commands which has key-bindings. How I can achieve that? I like to have reverse functionality as well, ie.. commands without key-...
0
votes
1answer
24 views

Finding missing Ediff key bindings

I was just looking at the Ediff manual¹ for something, and it's one of those Emacs manuals that (a bit annoyingly) only list keybinds and not function names (so, if you have rebinding going on, you ...
1
vote
1answer
24 views

Can which-key help with extended keyboard shortcuts?

I have two shortcuts defined like this ;; eval in shell (global-set-key (kbd "C-c x s") 'eir-eval-in-shell) ;; eval in ruby (global-set-key (kbd "C-c x r") 'eir-eval-in-ruby) which-key helps me ...
0
votes
0answers
23 views

Emacs mac-right-option-modifier variable doesn't work with Sticky Keys on in macOS

I've set right option modifier as super key using `(setq mac-right-option-modifier 'super) but if I have Sticky Keys on on macOS, it doesn't work.
1
vote
1answer
22 views

Command that does different things based on whether something is selected

I am trying to make emacs function somewhat like sublime text, where C-x cuts text that is selected and cuts the whole line when nothing is selected. I got the full-line cut to work using (global-set-...
0
votes
1answer
15 views

Display time of “You can run the command … with …” minibuffer hints

I type in, for example, M-x occur and it says You can run the command occur with M-s o. How can I make that last hint display for more than one second?
2
votes
1answer
32 views

Remapping global keybindings to a prefix command

The following works: (define-prefix-command 'my-map) (global-set-key (kbd "C-@") 'my-map) ;; MacOS (global-set-key (kbd "C-SPC") 'my-map) ;; Windows 10 The following does not: (global-set-key [...
1
vote
1answer
27 views

Can't change company coq mode map

I installed a minor mode for coq-mode, called company coq. It binds the <menu> key to company-coq-toggle-definition-overlay here: (defconst company-coq--core-map (let ((cc-map (make-sparse-...
0
votes
1answer
22 views

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

I am trying to bind S-RET to something, but it's getting ignored. If I do C-h k S-RET, I see RET (translated from <S-return>) runs... - which seems to suggest that Emacs sees the S- in S-RET ...
1
vote
0answers
19 views

C-< and C-, keys are echoed as C-\ in no-window mode

I'm trying to edit multiple lines with multiple-cursors package. MC package has C-< keybinding but when I do C-< (Control+less-than sign) it is echoed as C-\ (Control+backslash). I don't know ...
1
vote
1answer
19 views

remove keybinding from ess-extra-map

Related: https://stackoverflow.com/questions/7598433/how-to-remove-a-key-from-a-minor-mode-keymap-in-emacs How can I find out in which keymap a key is bound? There is a default keybinding in ESS ...
0
votes
1answer
24 views

How to use unbound keys as “non-sticky” modifier keys

I would like to setup keyboard shortcuts with other keys that traditional modifier keys, as modifier keys. example : bind "f1-left" ( so F1+←) to a command. But not bind the sequence F1 ← to the ...
0
votes
1answer
58 views

How to set key binding for read-only-mode? in order to simplify cursor movement

moving point command: next-line, previous-line, forward-char, backward-char, etc. How to omit Ctrl key in read-only-mode? How can I combine with read-only-mode-hook to automatically enable keybind ...
0
votes
0answers
25 views

Translating C-M-S-s to H

I followed a Linux tutorial that turns the Caps Lock key into the hyper modifier, so I defined some keys such as H-b. I'm using the same Emacs configuration on macOS, so I tried to map caps lock to ...
0
votes
2answers
64 views

Trouble binding C-return: C- must prefix a single character

This is what I have: (add-hook 'magit-status-mode-hook (lambda () (local-set-key (kbd "<C-return>") 'magit-diff-visit-file-other-window))) Opening a magit-status buffer fails with "C- ...
1
vote
1answer
19 views

With “japanese” input method, unmap kanji selection via the spacebar?

In emacs-26.1, I am enabling the Japanese input method as follows ... (toggle-enable-multibyte-characters 1) (set-language-environment "Japanese") (set-input-method "japanese") (setq coding-system-...
0
votes
0answers
39 views

Howto define TAB and S-TAB in keymap of custom mode

I'm trying to bind the TAB and shift TAB keys to a custom readonly buffer mode. The skeleton of the mode looks like this: ;; 8< --- exmode.el ------- (defun exmode-i () (interactive) (message ...
3
votes
1answer
74 views

What is the point of the Ctrl-M binding? Can I overwrite it if I use the Return key?

Looking for a new convenient keybinding for a frequently used command I stumbled upon Ctrl-M which is the same as Return/Enter. What is the point of this binding? Can it cause some problem if I ...
0
votes
0answers
41 views

<M-S-return> (org-mode) failing on Windows install

I've just installed Emacs 26.2 on a Windows 7 machine. This is a clean install, with no previous version of Emacs installed. Editing an Org file, I want to insert a new TODO item using "M-S-return". ...
1
vote
2answers
70 views

Overwrite global-set-key in major-mode

In my .emacs file I have bound the tab-key to a function called smart-tab. (global-set-key [(tab)] 'smart-tab) (defun smart-tab () "This smart tab is minibuffer compliant: it acts as usual in ...
0
votes
0answers
22 views

How to change the value of timeout for key sequences?

I have a key sequence for M-<SPC>: (global-set-key (kbd "M-<SPC> a") 'foobar) I would like to increase the timeout between keystrokes M and <SPC> for building M-<SPC>. How ...
2
votes
3answers
44 views

Disable tex-mode's auto tex-insert-quote functionaliy

So basically, for reasons unknown we don't use regular LaTeX style quotes at my company, instead just using regular double quotes. However, tex-mode in emacs automatically substitutes the " key for ``'...
1
vote
1answer
31 views

How to bind a key in a `generic` mode?

Is there a way to bind a key in a mode defined using define-generic-mode such as xmodmap-generic-mode? Generic does not appear to create keymaps. ELISP> (require 'generic-x) generic-x ELISP> (...
1
vote
1answer
42 views

Give key binding absolute priority [duplicate]

I'd like to use M-<arrows> to move around windows in Emacs gtk, so I have added (windmove-default-keybindings 'meta) to my init.el. However, this is overridden by other modes such as elpy. Is ...
0
votes
0answers
15 views

Keybindigs conflict between minor modes

The configuration that I have for python mode implies loading both elpy.el and python.el. The things is that I found the python.el keybindings more natural than the elpy.el ones. And most of the ...
2
votes
1answer
35 views

Prelude: How to add smartparens key bindings to C-c prefix?

I am using Emacs with Prelude. When I hit C-c prefix in a clojure buffer, I would like to show a smartparens key bindings. Like in screenshot below I would like to to add entry for smartparens key ...
0
votes
1answer
41 views

bind german mutated vowel keys to functions

I have a German keyboard and would like to bind Isearch to C-ö. How can I do this?
0
votes
2answers
34 views

Command to apply invisible property to selection

I would like to have a command that makes selected text invisible, and another to make selected text visible. Currently I have (buffer-invisibility-spec '(a . t)) (global-set-key (kbd "C-c i") (...
2
votes
2answers
129 views

Why does Shift-right says it is bound to right?

I tried to check what function shift-right is bound to which extends the region right by a character by default. But C-h k says: <right> (translated from <S-right>) runs the command right-...
1
vote
1answer
32 views

C-/ results in backspace in the Linux console

I am using emacs on many machines, and always use C-/ for undo. However, I started working on a Raspberry Pi with Arch Linux recently, using a local text terminal - X is not installed. Here, C-/ has ...
1
vote
0answers
32 views

Changing keybinding for org-capture [closed]

I expect my reception to compile my daily agenda using .org capture. But they find using C-c C; C-c C-s; C-c C-c to capture, schedule and completion respectively difficult. Can a single function keys ...
0
votes
0answers
27 views

Use arrows keys to call Lispy functions

In lispy-mode, I want to use control + the arrow keys instead of lispy's defaults (h, j, k, l). But if I run the obvious code (define-key lispy-mode-map [C-up] 'lispy-up) then C-up always ...
1
vote
1answer
51 views

Rebind just `C-c` to some command

I'd like to rebind C-c to eshell-interrupt-process, so I don't need to press C-c C-c. I tried the naive (local-set-key (kbd "C-c") 'something) And similar commands but when I press C-c emacs waits ...
4
votes
3answers
292 views

Use cases for M-0 & C-0?

The purpose of digit-argument and how to use them is described in Emacs manual. Also read a question that asks how to disable them. Even though have not disabled them, I have changed M-1, M-2, M-3 '...
0
votes
0answers
14 views

“<Hangul> is undefined” error on space key press

I'm running Emacs 26.1 without any "strange" configuration: a bare bone Ubuntu 19.04 emacs package with few packages installed from elpa or melpa. I have the following issue: when pressing space bar ...
6
votes
3answers
153 views

Progressive key bindings

In my emacs setup, I currently have two key bindings: C-C c i for command1 and C-c c j for command2. command1 outputs some text in the minibuffer while command2 insert the same text in the current ...
1
vote
1answer
28 views

Using C-x C-<left|right> for windmove

On a Mac, using Emacs 26.1, I'd like to bind my windmove functions using: (global-set-key (kbd "C-x C-<left>") 'windmove-left) (global-set-key (kbd "C-x C-<right>") 'windmove-right) (...