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
3
votes
3answers
105 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
43 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
33 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
60 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
23 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
30 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
0answers
14 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 ...
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 &...
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
111 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-...
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
104 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
43 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
78 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 ...
1
vote
1answer
51 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?
3
votes
1answer
84 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-...
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 ...
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 ...
2
votes
1answer
208 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" (...
1
vote
1answer
158 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
2answers
480 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
62 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
78 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 ...
0
votes
1answer
35 views

Treat initial numbers as argument to functions in minor mode

Is it possible to treat typed numbers similar to universal argument C-u 10 C-n, but make it so that there is no need to type C-u in a minor mode? So only 10 C-n would be needed to move 10 lines down ...
2
votes
1answer
246 views

How to set key binding for read-only-mode? in order to simplify cursor movement

moving point command: next-line, previous-line, forward-char, backward-char, etc. How to omit Ctrl key in read-only-mode? How can I combine with read-only-mode-hook to automatically enable keybind ...
1
vote
1answer
251 views

How do you automatically enable writeoom-mode when org-mode starts?

I want to enable writeroom-mode whenever I startup org-mode because I don't really ever want writeroom-mode to be disabled if I'm using org-mode.
2
votes
0answers
42 views

Keybindigs conflict between minor modes

The configuration that I have for python mode implies loading both elpy.el and python.el. The things is that I found the python.el keybindings more natural than the elpy.el ones. And most of the ...
0
votes
0answers
316 views

Disable auto-fill mode in all the major modes

When try to disable 'auto-fill-mode`, I search the following answers how to disable minor mode (enabled using prog-mode-hook) for a particular major mode This answer narrow it focus on the python-...
1
vote
1answer
132 views

How to turn typopunct minor mode on globally

I want to be able to use typopunct minor mode globally. I have tried to add (global-typopunct-mode 1) to my init file, like so ;; Typopunct mode (require 'typopunct) (typopunct-change-language '...
2
votes
1answer
82 views

How to use `recover-session` and `dired-omit-mode` in Emacs 26 and lower?

Using Emacs 26.1, I have enabled dired-omit-mode globally with (add-hook 'dired-mode-hook #'dired-omit-mode). When using recover-session, I don't see any files. How to fix this? Creating a .dir-...
2
votes
1answer
401 views

How to enable the superword minor mode globally?

I am just wondering how to enable the superword-mode globally? I tried to enable it following the answers found here: How to enable ido-mode forever? , using: (require 'superword-mode) (...
2
votes
1answer
138 views

Enabling a minor mode in all but some buffers

I want to enable display-line-numbers-mode in all buffers except pdf buffers. Can I do that without making a list of all the major modes except pdf-view mode?