6

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 same parent mode but not from each-other. We could probably introduce a lispish-mode as a parent of all major modes for Lisp-like languages, but I'm not ...


4

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-mode-hook' behaviours." (when (derived-mode-p 'prog-mode) ...)) Refer to https://stackoverflow.com/a/19295380 for more details on the sequence of events ...


3

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 auto-fill for nxml? The trivial approach is to simply switch it off in nxml-mode-hook. The mode will be switched on, and almost immediately switched off again. (...


3

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’ makes the parent mode’s keymap the parent of the new map, unless ‘VARIANT-map’ is already set and already has a parent. You've used ...


2

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)


2

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). This said, it may indeed bite you later, depending on what the rest of f90.el does. For Issue #2, you simply want to use the OVERRIDE field in your font-lock ...


1

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 cannot be given a sub-match number.


1

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 the hierarchy: (defun derived-modes (mode) "Return a list of the ancestor modes that MODE is derived from." (let ((modes ()) (parent nil)) (...


1

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 pretty risky: e.g. it won't work right if conf-mode is marked for autoloading when the above code is executed, and it can lead to inf-loops if you re-execute ...


1

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 recursion. You might attempt to hack your way around this, but I would firmly suggest that you just "don't do that". 1 For more details on how derived modes ...


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