All Questions

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

Trouble adding post-self-insert-hook in define-minor-mode

I am trying to write a minor mode that upon visiting a word, it manipulate it. There is a list of words which is parsed from a file. Here is the problem: (define-minor-mode auto-gls-mode "...
2
votes
2answers
153 views

Are there hooks for leaving modes?

There seems to be a bug in clojure-mode (mentioned here) because it does things in a mode hook (for paredit-mode) but doesn't undo them when the mode is turned off. I understand that add-hook can ...
2
votes
1answer
65 views

How to automatically remove a hook provided by a minor mode after disabling that mode?

I want to write a minor which evaluates some code in the buffer after saving a file. I activate after-save-hook for this mode: (add-hook 'my-minor-mode-name-hook #'(lambda () (add-hook 'after-save-...
1
vote
1answer
25 views

Set prefix key on load of minor mode

I am trying to change the default prefix key C-c @ to C-c for outline-minor-mode: (define-key outline-minor-mode-map (kbd "C-c") (lookup-key outline-minor-mode-map (kbd "C-c @"))) This ...
4
votes
1answer
81 views

How to suppress a minor mode's key binding in only certain major modes?

Suppose that I use minor mode MIN with a whole bunch of major modes. In one of those major modes, call it MAJ1, MIN's binding for a specific key K is undesirable; I would therefore like to suppress ...
0
votes
1answer
138 views

Save and restore variable

I am working on Spacemacs which gives you the ability toggle between Emacs "holy-mode" and Vim "evil-mode". However the evil-escape minor mode is still enabled. I am trying to find some way to disable ...
0
votes
2answers
366 views

How replace auto-complete-mode with company-mode in all major mode using it?

How I can replace auto-complete-mode with company-mode in all major mode using it? i.e. make all modes which activating auto-complete-mode (e.g. c-mode or sh-mode etc), activate company-mode instead ...
2
votes
1answer
323 views

how to disable minor mode (enabled using prog-mode-hook) for a particular major mode

I've enabled auto-complete-mode mode using prog-mode-hook like so: (add-hook 'prog-mode-hook 'auto-complete-mode), but I want auto-complete-mode to be disabled for python-mode. How can I achieve this ?...
0
votes
1answer
491 views

Enable visual-fill-column-mode only in text and programming mode

I am currently using visual-fill-column-mode and visual-line-mode in emacs with the following: (add-hook 'visual-line-mode-hook 'visual-fill-column-mode) (global-visual-line-mode t) (define-key ...
0
votes
1answer
191 views

How do I enable a mode, when another mode runs?

All I want to do is enable tern-mode, when I enter js-mode. I know that a hook called js-mode is run when I open a javascript file but for some reason tern-mode is not enabled. In my init.el file I ...
8
votes
2answers
814 views

How to activate semantic-mode for specific major modes only?

I've seen this question a lot. But none of the replies fixed my issue: the minor mode stays on in others modes. So far, I have tried: (use-package stickyfunc-enhance :config ;; (add-to-list '...
1
vote
1answer
119 views

Tie a minor-mode to a particular major mode

I'm writing an extension to a major mode (coq-mode) that adds extra features, plus a few keybindings. To makes it easy to disable or redefine these keybindings, I packaged them in a keymap. That ...
6
votes
2answers
982 views

Disable hl-line-mode only for eshell and ansi-term

I have global-hl-line-mode setup in my init file: (use-package hl-line :init (global-hl-line-mode 1)) Is it possible to disable it when I am in eshell and ansi-term? I tried adding a hook like ...
24
votes
3answers
5k views

Proper way to enable minor mode

I have foo-mode and would enable bar-minor-mode for it. So which way is more common and preferable? A (add-hook 'foo-mode-hook 'bar-minor-mode) B (add-hook 'foo-mode-hook (lambda () ...