10

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 ...


8

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. (characterp ?\C-q) t (characterp ?\M-q) nil Both are represented as integers, but there's a limit to the ints which are valid for characterp. See the following for details: C-hig (...


7

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-[>").


7

You ask several related questions, but this is the main one, I think: How does one find out what name emacs gives to a key such as the one labeled pause/break on my keyboard? For Emacs's description of a key, use C-h k. So C-h k, then hit the Pause key. Emacs probably tells you this: <pause> is undefined So you now know that Emacs describes that key ...


6

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. ...


6

Thank you for telling me about the different types of maps. The issue is as @NickD pointed out in their answer https://emacs.stackexchange.com/a/59269/9874 and the example use-package code puts all the bindings into the global map. ie org-mode puts the binding to "" in org-mode-map so you need to use that map. Because my configuration is based on ...


5

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.


5

The part you need to look at is the interactive declaration which in this case is (interactive "P"). This means that C-u is passing the argument (4) to org-timer-start. So you need to assign the lambda (lambda () (interactive) (org-timer-start '(4))) to a key in whatever keymap you want that will be active when you want to use it. The keymap ...


5

I have the following in my .emacs: ;; date (global-set-key "\C-\M-d" (lambda (arg) (interactive "P") (let ((separator (pcase arg ('(4) "-") (0 "/") (_ "")))) (insert (format-time-string (concat "%Y" separator "%m&...


4

Let us have a short look at the implementation of make-composed-keymap (in Emacs 26.3): (defun make-composed-keymap (maps &optional parent) "..." `(keymap ,@(if (keymapp maps) (list maps) maps) ,@parent)) The list maps is spliced in. When called with two maps and one parent you get a list (keymap (keymap el11 ... el1A) (keymap el21 ... ...


4

You can simply map the keys - and _ to do what you want in python mode: (defun insert-underscore () "Guess what!" (interactive) (insert "_")) (defun insert-hyphen () "You know it!" (interactive) (insert "-")) (defun python-remap-hyphen-and-underscore () (define-key python-mode-map "-" 'insert-underscore) (define-key python-mode-map "_" '...


4

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 () (interactive) (org-agenda-list nil nil 1 nil) (org-agenda-columns)) (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 ...


4

Calling org-store-link by C-c l in file.tex buffer will store a link in the org-stored-links variable. Then, calling org-insert-link by C-c C-l in notes.org buffer will insert the link to your org file by selecting the right stored link in the prompt.


4

M-S-Z would mean Meta + Shift + Z. But Z (uppercase) is itself what Emacs uses for Shift> + z. There's likely no key on your keyboard corresponding to S-Z. That's why you say it doesn't work. If you use C-h b you'll find your key binding listed OK. And if you use C-h w zap-up-to-char-backward you'll see that it says it's bound to M-S-Z. The problem is ...


3

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 lisp/repeat.el.~0a8cbe6881^~. 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, ...


3

S-l 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 For clarity: (kbd "L") "L" (...


3

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 ...


3

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 ...


3

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 ...


3

Org mode does a bunch of context-dependent actions by binding a key (e.g. C-c C-c or C-c RET) to a generic function (org-ctrl-c-ctrl-c or org-ctrl-c-ret). The function looks around to determine a context (am I in a header? or a source block? or a table? etc.) and then calls another function (e.g. org-insert-heading) depending on that context. I don't know ...


3

You're manipulating the wrong map: (with-eval-after-load 'evil (define-key evil-motion-state-map (kbd "g l") 'evil-end-of-line))


3

Modifier key s- is called "Super". (event-modifiers 's-Y) returns (super), which says that s-Y uses (only) the super modifier. See the Emacs manual, node Modifier Keys. What physical keyboard key, if any, might correspond to this logical modifier key depends on your system and hardware. (event-convert-list '(super ?y)) returns 8388729, which is ...


3

The mode sets up its own keymap which overrides the global map. The :bind mechanism creates a binding in the global map, but in an Org mode file, the key is looked up in the mode map before the global map, so you get the definition in the mode map. The usual way to override this is by using the mode hook. Add to your init file the following code: (eval-after-...


3

You are successfully binding C-c C-n in the global keymap, which is the lowest-priority keymap. Some major mode binding will be taking precedence, as: Sequences consisting of ‘C-c’ followed by a control character or a digit are reserved for major modes. -- C-hig (elisp)Key Binding Conventions I strongly recommend reading this article in full. It should ...


3

In most cases, an emacs instance runs for a very long time: what comes and goes is the buffer visiting a file. So instead of killing emacs as a whole, it is probably more useful to kill the buffer that is visiting the file. You do that with kill-buffer (usually bound to C-x k): if the buffer is modified it will ask you whether you want to kill it anyway and ...


3

(kbd "s-s") works just fine for me. Verified in both 27.1 and 26.3. I suspect your window manager is capturing this sequence, and Emacs never sees it at all. What does typing C-hks-s tell you? If Emacs doesn't register the s-s, then I think you'll find that never actually reached Emacs, and you should start looking at your window manager's ...


3

C-u invokes the function universal-argument, and you want to ensure that eval-last-sexp is called as if you invoked it interactively, which is done with call-interactively. You can simulate universal-argument by let-binding current-prefix-arg. Putting that all together: (global-set-key (kbd "C-c c") (lambda () (...


3

I think it's a bug. If you don't use that alist as the KEYMAP arg, but instead you create a keymap, assign it to a variable, use define-key with (kbd "C-n") etc., and use that variable as the KEYMAP arg, then it works. Please consider using M-x report-emacs-bug, to report this. (setq toto-map (make-sparse-keymap)) (defun foo () "..." (...


3

You can see what you've done with C-h l (aka M-x view-lossage). As for putting a kind of "safety fence", it should be fairly easy to do, by placing an appropriate function of pre-command-hook. You could start with something like: (defvar my-fence-let-pass '(self-insert-command next-line previous-line right-char left-char handle-select-...


2

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.


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