7

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


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


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

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

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


4

Currently, probably the best way to discover keybindings is by using the which-key package. This package is central in distributions like Spacemacs and Doom emacs. It provides various commands for discovering available keybindings, e.g. which-key-show-top-level and the which-key-show-(full)-major/minor-mode(-keymap)s. The which-key buffer can be shown ...


4

Are you sure you need new key-bindings? Did you know that you can call code blocks from other code blocks? See https://orgmode.org/manual/Evaluating-Code-Blocks.html You can bind code block by name in the header (e.g. :var x=random) to a variable, and call it by using the variable within the block. Also, especially if this is for debugging purposes, you can ...


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

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 for C-u C-x C-e: (global-set-key (kbd "C-c c") (lambda () ...


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


4

Each command that sets the mark pushes the previous mark onto a stack. More precisely, the previous position is added to the mark ring (the difference between a mark and a ring is that accessing the front of the ring doesn't remove the element, but pushes it to the other side of the ring). To get to the next-to-last position, use C-1 C-SPC or C-u C-SPC. ...


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

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

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


3

As you're not going to use the region between point and mark, consider another approach using save-excursion, like this one: (defun auto-import-word-at-point() "Autoimport word at point." (interactive) (let ((word-at-point (thing-at-point 'word))) (save-excursion (goto-line 2) (insert (concat "import ...


3

I think any key name that's more than one character needs to be be inside <>, so try (define-key org-mode-map (kbd "<F1>") 'org-toggle-todo-and-fold)


3

Not that I know of, but Org mode provides the ingredients to roll your own easily: (defun org-table-goto-beginning () (interactive) (goto-char (org-table-begin))) (defun org-table-goto-end () (interactive) (goto-char (org-table-end))) (define-key org-mode-map (kbd "C-c t b") #'org-table-goto-beginning) (define-key org-mode-map (kbd &...


2

Tryto launch emacs with : env XMODIFIERS= emacs This runs Emacs without the XMODIFIERS environment variable set, which disables input methods for just that program.


2

Using use-package's :bind by setting the binding to nil worked for me in similar cases, but I use it with :straight org-plus-contrib and I do not know if this approach applies the same with built-in org: (use-package org :straight org-plus-contrib :bind (:map org-mode-map ("C-," . nil) ("C-'" . nil)))


2

Not sure I understand your question. Are you asking how, in each major mode, to bind to C-o whatever that mode normally binds to C-e? If so, then in after-change-major-mode-hook add a function such as this: (defun my-remap-C-e-to-C-o () "Remap whatever command is locally bound to `C-e` to `C-o`." (let* ((map (current-local-map)) (C-e-...


2

I can't really answer on why some keybinding are put under , and some under C-c. To know the difference between the two, you can check what bindings they prefix with the shortcut , C-h and C-c C-h. Other usefull bindings are: C-h m to show what the current major mode bindings are C-h k C-c [ to know what's bound to C-c [ C-h f org-agenda-file-to-front ...


2

Have a look at Adding keymaps to src blocks by John Kitchin. It does more than you want. You can edit src blocks as you would normally edit code of that type. There is a link to a file in org-mode that you can download and evaluate to make this available for you. You will need to adapt the recipes he gives for your needs. The major problem is defining the ...


2

Assuming that helm-projectile is doing this: (define-key projectile-mode-map [remap projectile-grep] #'helm-projectile-grep) You would disable that with: (define-key projectile-mode-map [remap projectile-grep] nil)


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