Questions tagged [minor-mode]

provides optional features that users may enable or disable independently of the choice of major mode. Minor modes can be enabled individually or in combination with other modes.

Filter by
Sorted by
Tagged with
37
votes
4answers
8k views

How to override major mode bindings

Sometimes my global keybindings are overridden by a major mode. An easy example is the following setting in my init file (global-set-key (kbd "C-j") 'newline-and-indent) But annoyingly this ...
8
votes
3answers
2k views

global-auto-revert-mode doesn't seem to work?

My init file includes (setq global-auto-revert-mode t) and I can confirm it's true with C-h v. But I still have to manually revert all my files with revert-buffer whenever I change git branches. I ...
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 () ...
1
vote
1answer
260 views

How to set a rule for the order of minor-mode-map-alist

Suppose we have 3 mode, one such rule is like key map for mode 1 should always come before mode 2, and mode 3 should always come before mode 1, finally mode 3 should always come before other minor ...
6
votes
2answers
3k views

Disable Minor Mode in Major Mode

I am trying to disable a minor mode (flycheck) for the latex major mode. This is what I have so far. (defun disable-flycheck-in-tex-src-block () (flycheck-mode -1)) (add-hook 'latex-mode-hook '...
3
votes
1answer
119 views

How can I 'layer' a keybinding?

I'm trying to create an emmet-like minor mode that will trigger on SPC (or TAB) if the previous text is expandable, but I don't want to completely override bindings that already exist for the key. ...
20
votes
8answers
6k views

Hide list of minor modes in mode-line

I use quite a few minor modes and usually I know which minor mode is enabled in every major mode. If I really want to see the full list, I can run C-h v minor-mode-list. At the same time, my mode ...
5
votes
2answers
1k views

Can I add highlighting in a minor mode?

I'm trying to understand minor modes with the goal of adding a minor mode for Jinja2 syntax highlighting (from jinja2-mode) to stuff like YAML. I'm running into problems though. When following a ...
4
votes
0answers
51 views

How to do searches in MediaWiki mode?

How to do searches in MediaWiki mode? If I instead do searches in Web browser, and then copy the URI of the page into Emacs, it sort of defeats the purpose of using Emacs as and MediaWiki power ...
10
votes
1answer
636 views

Disabling electric-indent-mode for one mode (latex mode) only

I don't like the way electric indent mode works in latex-mode. Everywhere else (at least everywhere I use), it's great. How can I permanently disable electric indent mode for latex mode only, but ...
6
votes
2answers
981 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 ...
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-...
7
votes
3answers
2k views

Auto enable minor modes in fundamental-mode

By design, the fundamental-mode is bare bones as other major modes are supposed to derive from this one. From the info page (elisp) Major Modes, we have: This is the major mode command for ...
6
votes
3answers
827 views

How to make electric-pair-mode buffer local?

I would like electric-pair-mode to be enabled only in the buffers where I am editing, say, Emacs Lisp. But it seems that electric-pair-mode is a "global minor mode": if it is activated in one buffer, ...
2
votes
1answer
394 views

Make all text of a given face invisible

Is there a straightforward way to make all text with a given face invisible? I don't believe I can make invisibility be intrinsic to the face, but can I perhaps specify a minor mode that makes sure ...
4
votes
1answer
463 views

How to look up documentation for a minor mode?

I just decided that I should try the outline-minor-mode for showing and hiding Emacs lisp defun definitions in an Emacs Lisp file. So I typed M-x outline-minor-mode and then I would like to get an ...
3
votes
1answer
289 views

How to learn the stroke order of a kanji (or kana) character using Emacs

As a devoted Emacs user and a Japanese beginner learner, I've been using the Emacs' Japanese input method quite a lot during recent months. However, I've been looking for a way to leverage Emacs' ...
2
votes
1answer
321 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 ?...
2
votes
1answer
194 views

Mode local variables

I frequently use file-local variables, but after writing some minor modes I find the need to implement mode-based behavior. Let's say I want to define a variable errors-list-regexp that varies ...
2
votes
1answer
120 views

How to detect if current major-mode supports which-function and semantic/find?

I am implementing a feature to automatically generate a bookmark name by extracting information from the current context. Many packages provide such info. For example which-func (through (which-...
0
votes
0answers
61 views

Disabling automatic line highlighting

Every time I open a new file in emacs, hl-line-mode is enabled. I have put (global-hl-line-mode -1) (hl-line-mode -1) in my init.el, but to no avail. What am I doing wrong???
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 ...