Questions tagged [hooks]
Hooks are an important mechanism for customizing Emacs. A hook is a Lisp variable which holds a list of functions, to be called on some well-defined occasion.
411
questions
2
votes
1
answer
51
views
Disabling some symbols from being prettified in a given mode
In AucTeX, I want to use prettify-symbols-mode but not prettify "--" and "---".
Why is the following not working?
(add-hook 'LaTeX-mode-hook #'(lambda ()
...
1
vote
1
answer
44
views
Make backticks electric for markdown mode
I'm trying to use electric pair mode for backticks in markdown mode. The following code hasn't worked and throws and error whenever I type a backtick. How was it wrong?
(defvar markdown-electric-pairs ...
1
vote
1
answer
51
views
How can I call a self defined function on Emacs startup?
I'm very new to Emacs and i would like to know why the following doesn't work for me:
When I run Emacs, I would like to have my ~/ buffer displayed. I previously defined my own function to get back to ...
0
votes
1
answer
37
views
Can cape be disabled on a mode basis?
I love using cape in text mode, but I cannot figure out how to stop it from activating in programming modes. Is it possible to either only enable it in certain modes or to disable it in specific modes?...
1
vote
2
answers
71
views
Toggle minor modes in all current and future buffers derived from specific major mode
I am new to elisp. That's why I'd be glad if some of you could help me out.
What I want to achieve
I want to enable hl-line-mode and display-line-number-mode in all current and future buffers derived ...
0
votes
2
answers
73
views
before-save-hook not working with use-package and custom mode
I wrote a little derived mode for the kage shader language, it's derived from go-mode (syntax is the same). I also like to use gofmt, but it's just not loading the hook.
Here's the mode:
(define-...
1
vote
1
answer
39
views
Run functions/hooks automatically when a specific FILE is opened
I'd like to run a function/set of functions when I open a specific file.
Just like file type hooks, but for a specific file.
For instance, when I open foo.bar, I'd like some functions to run.
Maybe ...
0
votes
1
answer
62
views
Configure compile command to take buffer-file-name as its source file argument
I am in the way of automating my compilation process with, what is an unexplored but an omnipotent command compile. I expect it to decide upon the compiler using the filename extension & also, ...
0
votes
0
answers
19
views
How to put 'viper-change-state-to-emacs function on some hook
I am using viper-mode, which is vi emulator and can be switched to the original emacs mode with viper-change-state-to-emacs, when I edit program files.
But, sometimes I want to create some special ...
0
votes
1
answer
37
views
Precomposing all commands in a keymap with a function using a variable in another command
I'm working on a plugin that allows avy to act from a distance and immediately return to its starting position, which mostly works. However, there is a problem in that an action, such as the deletion ...
0
votes
1
answer
40
views
company-mode: static sources overwrites LSP
I had a short experience with emacs a few years ago (spacemacs), and now I want to get back to it seriously. Within literally 3 days, I built my own config that turned regular emacs into a full-...
0
votes
1
answer
36
views
Placing a hook after each character insertion
I'd like to define a minor mode in which, when I write something, point is not moved and the characters are instead inserted after point. I thought that would be easy: just add a hook after insert-...
0
votes
1
answer
53
views
Macros expanding to addhook
I have the following configuration lines in my init.el file regarding a specific mode:
(add-hook 'pdf-view-mode-hook (lambda () (local-set-key (kbd "SPC h") #'evil-window-left)))
(add-hook '...
0
votes
0
answers
22
views
Branch descriptions in the magit references buffer
It would be convenient (for my workflow) to have the "references" (y) buffer display branch descriptions (as in git-branch --edit-description) instead of the latest commits titles. Is there ...
0
votes
0
answers
31
views
Unable to install packages due to run-hooks error
I'm getting a strange error when installing packages using package-install.
I haven't really updated anything in my configs but package installation suddenly stopped working. Any pointers or ...