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
5
votes
2answers
276 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 ...
3
votes
3answers
104 views

load user-written minor mode in a specific major mode

I'm trying to use a very simple minor mode I've written to personnalize the appearance of the buffer when I'm running R in ESS. Basically, I've set the linespacing in my init file to increase it and ...
2
votes
2answers
42 views

How to programatically detect if a minor mode is global or local?

Is there a way to programatically detect (in Elisp) if a minor mode is a global minor mode or a local minor mode? For instance I'd like to be able to detect that show-paren-mode is a global minor mode ...
0
votes
1answer
41 views

Define new key binding for new minor mode

I am writing my first minor mode, and would like to understand how to bind a key to an action in that mode. (define-minor-mode hello-mode "My Mode" :init-value nil :lighter " ...
0
votes
1answer
31 views

Disabling visual-line-mode only in org-agenda-mode

My emacs configuration has global visual line mode enabled via (global-visual-line-mode 1). I want to disable this mode, but only when in org-agenda-mode. When I do this manually, via M-x org-agenda, ...
0
votes
1answer
15 views

How to make this mode work in all buffers except for the SLIME's REPL buffer?

I have this minor mode set to work on all buffers: ;; John Mercouris centered point mode ;; Homepage: https://github.com/jmercouris/emacs-centered-point (define-minor-mode centered-point-mode "...
1
vote
1answer
58 views

Different abbrevs for each major mode

The https://www.emacswiki.org/emacs/AbbrevMode says You can have different abbrevs for each mode (cperl, c++, Message); but it doesn't show exactly how, yet that's exactly what I am looking for. So, ...
0
votes
0answers
22 views

How to detect the difference between an application buffer and text editing?

I have created a minor mode which has the option to be enabled globally via define-globalized-minor-mode. This mode is intended to be used for text editing, however the globalized version gets enabled ...
2
votes
1answer
72 views

New line and indent without electric mode

I have come to hate the inconsistency of the electric indent mode and I haven't much of a clue about how it works anyways, so I've disabled it and am trying to get the desired behavior from scratch. I ...
1
vote
0answers
29 views

Combine `flyspell-region` with`writegood-mode`

I would like to combine flyspell-region with writegood-mode, but writegood-mode does not provide a function to check a region of text. This is what I came up with to work around the limitation: (defun ...
0
votes
2answers
122 views

lose reftex-isearch-minor-mode after refresh

I want to activate reftex-isearch-minor-mode and tried the solution in this post offered by giordano, (add-hook 'TeX-mode-hook (lambda () (reftex-isearch-minor-mode))) ; for AUCTeX it works when I ...
3
votes
3answers
40 views

Rebinding M-q in `define-minor-mode`

I'm trying to define a minor mode that rebinds M-q to a modified version of fill-paragraph. What I've written so far: (defun myfun () (message "myfun called")) (define-minor-mode mymode &...
0
votes
0answers
12 views

How to make ryo-modal not insert undesired keys?

According to its project page ryo-modal, ryo-modal keeps unmodified all keys that weren't allocated for it. Notice that other keys are unmodified, so pressing r would insert r into the buffer. My ...
1
vote
1answer
46 views

How can I have the lighter of a minor mode be colored /propertized)?

How can I colorize/propertize the lighter of a minor mode in the mode line?
1
vote
1answer
108 views

Disable minor mode in specific major-modes or changing buffers (i.e. selectrum for prog-modes but not in shell)

This is similar to many other questions but nothing is leaping out.. I'm a fan of selectrum (similar to helm and ido I gather): e.g. hit M-x and start typing, it'll find matches and list them. I'd ...
1
vote
0answers
17 views

Emacs Mode to edit template toolkit files

Is there a mode to edit template toolkit files ? Web-Mode works decently, but maybe some modes can be combined to proved some specific Perl-editing-Funcitonality?
3
votes
1answer
43 views

How to list a newly formed emacs minor-mode?

With some help from the blog post found here, I have managed to write a small code for a test package (a minor mode) named niranjan. It is as follows. (define-minor-mode niranjan-mode "Hello ...
0
votes
1answer
60 views

Automatically enable a mode with dir-locals.el

I'm trying to achieve the effect of automatically calling M-x importmagic-mode whenever I open a python file, but I need to do this in a directory specific way, using dir-locals.el. I have this in dir-...
19
votes
3answers
5k views

Get list of active minor modes in buffer

How get a list of active minor modes in current buffer? Docs (info "(elisp)Minor Mode Conventions") say: Define a variable whose name ends in ‘-mode’. We call this the "mode variable&...
0
votes
0answers
54 views

Error in Latex-mode

I keep getting an error in Latex-mode while moving up and down the lines with a cursor: wrong-type-argument stringp nil and a beep on every move. I got the newest version. What can be the problem? (I ...
0
votes
2answers
102 views

Defining minor-mode buffer-local variables

I want to do something VERY simple. I want to create a minor mode, which when enabled sets a buffer-local variable (say left-margin-width, for instance) with a specific value. I can do this: (define-...
0
votes
0answers
35 views

pdf-view-midnight-minor-mode does not change background color

The pdf (black text on white background) I'm currently reading in PDFView with pdf-view-midnight-minor-mode enabled only changes the color of the text from black to gray but the background remains the ...
0
votes
0answers
19 views

Bug? Can get point into the middle of a run of characters with a replacing display spec

I'm implementing a minor mode that "folds" certain strings. It does this by adding a font-lock keywords rule to the buffer, that applies display properties that make it look like it's a ...
1
vote
1answer
42 views

How to get the mode-specific help information or help files

No matter in which mode I am currently in, is there a general way / key combination to open the help file related to the currently active mode?
4
votes
1answer
77 views

Why my minor mode bindings do not get precedence over global/major mode bindings? BUG?

EDIT: ANSWER The cause for the problem in this question was pointed out in the Emacs mailing list. It is due to the (kbd ...) forms not getting evaluated because the keymap in the define-minor-mode is ...
3
votes
1answer
84 views

Adding new keywords delimeters

I am new to the Emacs (Doom Emacs to be precise) scene, and recently I came up with a minor mode that could come in handy for me so I decided to implement it. To achieve the full functionality of my ...
5
votes
4answers
1k views

Making it clearer I'm in god-mode

I've been using emacs for a while, but am being quite dismayed by some quite hectic pinky-pain, so have just started using Chris Done's god-mode, which is great, I like it so far. The problem is that ...
7
votes
1answer
417 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
50 views

How to enable org mode and evil mode for untitled buffer when creating a new frame

The code below creates a new frame with an untitled buffer, how to make this buffer default with org-mode and evil-mode? (global-set-key (kbd "s-n") 'new-empty-frame) (defun new-empty-frame ...
0
votes
1answer
72 views

Custom Keybindings not working

I had to reinstall emacs and completely redo my config file, but for some reason, some of the custom keybindings that used to work with "move-dup" package from Melpa. Here is what i have: #+...
2
votes
1answer
144 views

How can I see what Major and Minor modes I'm currently in?

Is there an easy way to see what modes are currently operating in a buffer? And have a list of their names?
27
votes
9answers
8k 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 ...
3
votes
1answer
83 views

Toggling minor modes based on other minor modes

I wrote a function to enable some minor modes when another minor mode is enabled: (defun prose-mode() (display-line-numbers-mode) (variable-pitch-mode)) I added prose-mode as a hook for olivetti-...
1
vote
1answer
72 views

File mode name with -mode suffix or not?

I am not sure when I should name file x-mode.el and when x.el. Note that because of established practice mode writer should put (provide 'x) or (provide x-mode) to the end of file and end-users load ...
0
votes
0answers
61 views

Add a keymap to a minor mode

The minor-mode show-paren-mode does not have a keymap. Is there a way to add such a keymap so that I can define some key-bindings that depend on this minor mode? I saw a solution here which involves ...
3
votes
1answer
184 views

Understanding precedence of minor modes keymaps

I would like to understand when keymaps of minor modes get "applied" and how do they get applied exactly? In particular, is there a way to see a list of a active minor-mode maps? I know I can look the ...
50
votes
5answers
12k 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 ...
0
votes
0answers
42 views

Highlight matching parenthesis, only in Lisp mode (and maybe a few similar modes)

is there a way to have the global minor mode show-paren-mode functionality as a buffer-local minor mode? I love its behavior but only for Lisp. Searching for a package I can see a number of close ...
14
votes
3answers
705 views

How do you update a minor mode definition as you develop it?

I started coding a minor mode to provide some keybindings. My initial attempt had a typo: (define-minor-mode borked-mode "A mode defined with a broken key binding" nil nil '(([b] . 'previous-...
1
vote
1answer
157 views

disable minor mode inside source blocks

i have org mode set up with typo minor mode and pretty entities enabled by default. but when i work on programming, these two are totally useless inside the source code blocks i insert into org ...
2
votes
1answer
207 views

eval and quotes

I am trying to execute the code here, which I copy below (defun buffer-local-set-key (key func) (interactive "KSet key on this buffer: \naCommand: ") (let ((name (format "%s-magic" (...
2
votes
2answers
476 views

How to set minor mode variables in dir-locals?

Im writing an lsp-mode purescript client and couldn't figure out how to override the default config options using a .dir-locals file. For example, I have a defcustom : defcustom lsp-purescript-use-...
2
votes
2answers
105 views

Enabling minor modes via customize

I see that minor modes defined via define-minor-mode have a variable that has the same name as the function and the following documentation: Setting this variable directly does not take effect; ...
0
votes
0answers
61 views

mac-mwheel-scroll screws centered-positon-mode when using mouse pad on a macbook laptop

I am able to scroll using navigation buttons and external mouse on a Mac with this code that keeps the cursor at a specific line at all times. I am using this code since it is much faster than ...
1
vote
2answers
32 views

Can a mode setup function fail?

If I define a new mode using define-derived-mode or define-minor-mode, can the mode setup somehow signal failure so that the mode is not activated? All of the following modes are activated despite ...
0
votes
0answers
50 views

Enable prog-mode when minor mode is activated

I created a minor mode for some specific file extension to fontify the syntax and provide correct indentation. 1)The indentation doesn't work for some reason. 2) How to enable prog-mode when the ...
0
votes
1answer
77 views

How to disable a minor/major mode so that mwheel-scroll don’t take effect?

I am trying to have a simple solution to center the cursor at all times. I found that centered-cursor-mode was too slow and found this simpler solution. The only problem is mouse scrolling no longer ...
1
vote
1answer
100 views

Why is `key-chord-mode` not listed among enabled minor modes?

After starting Emacs with the following init.el file, key-chord-mode is turned on. ;; Speed up startup (setq gc-cons-threshold 402653184 gc-cons-percentage 0.6) (add-hook 'after-init-hook ...
1
vote
3answers
41 views

Swap Shift/non-shift key behavior for particular mode

I want to press - on my keyboard and have _ be inserted and vice-versa only for a particular mode. The following does this globally using the post-self-insert-hook, It checks the character just ...
0
votes
1answer
64 views

I can turn on minor modes like electric pair modes in my init, but they’re not having effect unless manually reactivated [duplicate]

So I can put a line like, (setq-default global-linum-mode t) or (setq-default electric-par-mode t) in my init file, and I can check with C-h v that the variables are in fact set to t (they are), but ...