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.

Filter by
Sorted by
Tagged with
2
votes
1answer
1k views

Get irony-mode to automatically load .config_clang

So irony-mode scans include directories through a file called .clang_complete, which looks like something like: -I./include/ However, it does not automatically load this file. Rather, I have to go ...
5
votes
2answers
198 views

How to ensure lines are always displayed in groups of 3?

I am writing a major-mode which displays a list to the user. It is similar to tabulated-list-mode, except each entry takes up 3 lines, as opposed to just one: 0 0 Ctrl-} key in emacs 5m ...
1
vote
2answers
119 views

Why is `gnus-group-prepared-hook` never called?

I'm wondering why this hook never works: (add-hook 'gnus-group-prepared-hook 'gnus-group-list-all-groups) Description of the hook: is called as the very last thing after the group buffer has been ...
3
votes
1answer
277 views

`find-file-hook` problem for large buffer that is just one long line

I got a file(for instance, ~/.mozilla/firefox/xxx.default/sessionstore-backups/recovery.bak) that its content is one whole line and size of over 1MB, if I open it in Emacs, Emacs will become very ...
16
votes
3answers
2k views

Is there any way to run a hook function only once?

The context I'm using the after-make-frame-functions hook to load properly the themes in an emacs client/server configuration. Specifically this is the code snippet that I use to make that (based in ...
0
votes
1answer
106 views

How does autoload cookie work on non defun form

sometimes I see a "unkosher" use of autoload coookie, for example: ;;;###autoload (add-hook 'some-hook 'some-fun) How will the above work? Will it add a hook just by being installed (as autoloads ...
6
votes
3answers
660 views

Focus-hook: attenuate colours when losing focus

How can I use the focus hooks to attenuate all colours in visible buffers when the Emacs frame loses focus? I tried using the following code: (set-frame-parameter (selected-frame) 'alpha '(100 80)) ...
13
votes
2answers
1k views

Where should I include a lazy initialization?

I want to add a specific key binding to latex-mode: (define-key latex-mode-map (kbd "<f6>") 'my-latex-defun) At the same time I want to set it only when the specific mode is loaded. So I ...
5
votes
1answer
828 views

What is the difference between setq-mode-local and setq-local

I don't understand how setq-mode-local works (mode-local is a package from cedet). The macro's documentation says: setq-mode-local is a Lisp macro in `mode-local.el'. (setq-mode-local MODE &...
7
votes
2answers
952 views

Hook that indicates when the cursor has been moved by scrolling

Inspired by this question: Let Emacs move the cursor off-screen, I am considering writing a minor mode that will keep the cursor in a fixed position that is not affected by scrolling operations. I ...
3
votes
3answers
847 views

Debug why a function is removed from post-command-hook

I am trying to implement the auto-indentation snippet posted by @Malabarba in one of the emacs SE questions. From that post, below is the function that I am trying to add to the post-command-hook: (...
5
votes
2answers
292 views

Detect when a key is rebound to another command

First, some context: I am in the process of debugging a strange interaction between smartparens and Org Speed Keys: After editing an .org file for a while, specific speed keys for navigating the ...
4
votes
2answers
629 views

Turn off jabber notifications when Emacs has focus

I use jabber.el to communicate with people at work, and I have sound notifications setup so that I get notified even when I’m not using Emacs. The notification is setup in the following way. (add-...
16
votes
2answers
711 views

How to find out what a key sequence really does

From time to time I observe unexpected behavior when editing text. My first recourse is usually to use C-h k to find out what functions are being called by a given key sequence. However, sometimes ...

1
3 4 5 6
7