4

You don't need a minor mode to customize the appearance of a major mode. You can do that more simply with a function called from the mode hook: (defun my-ess-hook () (setq line-spacing 1)) (add-hook 'iESS-mode-hook 'my-ess-hook) (set-face-attribute 'default ...) will change the default face for the whole Emacs frame, it doesn't apply to a single mode ...


3

You are right in assuming that the location is wrong. Emacs does not know about your niranjan directory. You assume that ~/.emacs.d/elpa/ is a special location and that emacs automatically knows how to add packages installed in there. If you look at the contents of the variable load-path, you'll see that is not the case. Every package that has been ...


2

Contrast M-f1 for a function key with ?\M-f for a character. You've bound myfun to [M-q] which means the one-key sequence where the key is the function key called q (which does not exist) with the modifier whose prefix is M (which is meta). Instead of referencing a function key q, you need to reference the character q. You can write this [?\M-q], or in ...


2

Refer to the manual: C-hig (elisp)Properties in Mode Or in the online manual (which is always for the most recent stable release of Emacs): https://www.gnu.org/software/emacs/manual/html_node/elisp/Properties-in-Mode.html I think there's no point in quoting an excerpt here -- you need to read the whole page.


2

Your code works perfectly, for me. Did you try it in emacs -Q (no init file)? And if I load library help-fns+.el and then use M-k hello-mode-map it shows me that M-p is bound to an (anonymous) command. However, I recommend that you give your keymap a name (a symbol). That helps users (and yourself) more. (If you have an Emacs 28 preview then you also have ...


2

Something like (add-hook 'slime-repl-mode-hook (lambda () (centered-point-mode -1))) which toggles the mode off in slime REPLs.


2

As you've seen, abbrev normally requires the abbreviation to contain only word-constituent characters, and that doesn't normally include `. You could make that character word-constituent by changing its syntax for the mode in question, but I believe it would be better to adapt abbrev (only) to your requirement (as lots of things are affected by syntax). You ...


2

In a terminal the value of [(return)] doesn't apply. You need to use (kbd "RET") instead. (or probably other variations would do, but not [(return)]).


2

I tested the (mapcar #'car minor-mode-alist) solution, but its length doesn't change after I disable a minor mode (while M-x describe-mode reflects this). Moreover, it seems inaccurate as I can't find some minor-modes listed by M-x describe-mode. I tried the package manage-minor-mode which allows users to enable/disable a minor-mode through an interface. ...


2

See the doc string for define-minor-mode: (define-minor-mode MODE DOC [KEYWORD VAL ... &rest BODY]). IOW, the code that should be executed when the mode is enabled (and also when the mode is disabled) has to be included as the BODY in the define-minor-mode form. Something like this: (define-minor-mode ess_XXX-mode "Personal configuration of ESS'&...


2

Your ess_XXX-mode.el file needs to be in a directory which is present in your C-hv load-path list. Your ~/.emacs.d directory is not present in that list by default (and you should not add it). If necessary, create a new directory such as ~/.emacs.d/lisp and add that to your load-path. (add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))


1

That information isn't stored, unfortunately. You can check whether the mode variable show-paren-mode is global or buffer-local: (local-variable-if-set-p 'show-paren-mode) That's not a guarantee (there's nothing stopping you giving a global mode a buffer-local value), but it's a reasonable heuristic. You might deal with that issue with: (with-temp-buffer (...


1

I'd consider calling (define-key mymode-map [remap fill-paragraph] #'myfun) from mymode-hook rather than defining it in the minor mode. (defun remap-fill-paragraph () (define-key mymode-map [remap fill-paragraph] #'myfun)) (add-hook 'mymode-hook #'remap-fill-paragraph) This means you don't have to remember to change the minor-mode mapping if you ever ...


1

Attempting answering my own question: Try 1: partially works, but as per comments below doesn't seem reliable Create a wrapper global mode, that is selective about when it enables. (define-global-minor-mode my-global-selectrum-mode selectrum-mode (lambda () (when (not (memq major-mode (list 'shell-mode))) (selectrum-mode)))) ...


1

See C-hf kill-local-variable for reverting a buffer-local variable to the global state. If you just set the buffer-local value to the variable's current default value, then it's still a buffer-local value (i.e. it won't reflect future changes to the default).


1

Minor modes are toggles. Defining a minor mode also creates a variabel with the same name. This variable is toggled when enabling/disabling the minor mode. So following code works: (define-minor-mode margin-mode (if (not margin-mode) (setq left-margin-width 3) (setq left-margin-width (default-value 'left-margin-width)))) Elisp is a Lisp-n type ...


Only top voted, non community-wiki answers of a minimum length are eligible