6 votes
Accepted

Why isn't emacs-lisp-mode derived from lisp-mode?

Because lisp-mode is actually meant to be the major mode for Common-Lisp. Emacs-Lisp and Common-Lisp are closely related but neither is a superset of the other, so they should both derive from the ...
user avatar
  • 25.4k
4 votes
Accepted

How to run a 'prog-mode-hook' after more specific hooks?

You can use after-change-major-mode-hook: (add-hook 'after-change-major-mode-hook 'my-after-change-major-mode-prog-mode) (defun my-after-change-major-mode-prog-mode () "Custom `after-change-major-...
user avatar
  • 43.9k
4 votes
Accepted

Prevent hooks from parent mode in derived mode

Prevent hooks from parent mode in derived mode Not trivial. I certainly can't think of a nice approach. You may find https://stackoverflow.com/a/19295380 of interest, though. How can I disable ...
user avatar
  • 43.9k
3 votes
Accepted

Hide a command from user

The nearest language-supported way is: (put 'my-command-to-suppress 'disabled "Don't do it! No, really, don't! I mean it!") This does not completely disable the command, but (by ...
user avatar
  • 1,354
3 votes
Accepted

Derived mode without merging keymap

From the manual (elisp) Derived Modes, define-derived-mode defines keymaps using the following rules: The new mode has its own sparse keymap, named ‘VARIANT-map’. ‘define-derived-mode’ ...
user avatar
  • 20.5k
2 votes

How to run a 'prog-mode-hook' after more specific hooks?

Here's another option: (defun my-prog-mode-hook () (when (derived-mode-p 'rust-mode) (setq fci-rule-column 99)) (fci-mode 1)) (add-hook 'prog-mode-hook #'my-prog-mode-hook)
user avatar
  • 25.4k
2 votes
Accepted

Derived major mode: new keyword fontification not playing nice with parent mode's

For issue #1, setting { and } to word syntax is wrong. You can give them "symbol constituent" syntax, but not "word" (otherwise you break the expected behavior of M-f and friends)....
user avatar
  • 25.4k
1 vote
Accepted

disable lsp-mode for derived mode of haskell

Creating a wrapper like this and using it instead of lsp function should be good enough: (defun my/lsp () (unless (eq major-mode <REPLACE-ME-WITH-MAJOR-MODE>) (lsp)))
user avatar
1 vote
Accepted

Syntax highlighting of keywords only if following builtin

In mwe-args-regexp you need (regexp-opt mwe-args-list "\\(?2:") and then everything should work. Explanation: without the extra argument, regexp-opt produces a shy group construct which ...
user avatar
1 vote
Accepted

How to find inheritance of modes?

Property derived-mode-parent of a mode symbol gives you the parent mode it is derived from. (get 'latex-mode 'derived-mode-parent) (get 'tex-mode 'derived-mode-parent) This will give you a list of ...
user avatar
  • 70.3k
1 vote

defalias derived mode to parent mode

Here's how you can do what you intended, while avoiding the inf-loop: (defalias 'old-conf-mode (symbol-function 'conf-mode)) (define-derived-mode conf-mode old-conf-mode ...) Note that this is still ...
user avatar
  • 25.4k
1 vote
Accepted

defalias derived mode to parent mode

The nature of a derived mode is that its parent is called before the body of the child mode is evaluated1. Therefore if the child becomes its own parent (or grandparent, etc...), that causes infinite ...
user avatar
  • 43.9k

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