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 for buffers such as package-menu-mode (the package list view), where it doesn't make sense.

What is a good way to differentiate text editing buffers from application buffers such as IRC, email, games ... etc.

  • How about using derived-mode-p and/or memq with a list of major-modes to include and/or exclude? – lawlist Jun 17 at 4:59
  • I think I've found this (derived-mode-p 'special-mode) seems to do what I want, although it doesn't seem like such a common thing to check - at least I don't see other packages doing this very much. – ideasman42 Jun 17 at 5:07
  • 1
    And .... you can include several major-modes as arguments to derived-mode-p if so desired .... – lawlist Jun 17 at 5:08
  • You can turn it around. You can enable it for modes that inherit from prog-mode and text-mode, plus a user-configurable list. I've use this approach (sometimes with an "avoid" list) in several of my packages, e.g github.com/Lindydancer/dynamic-spaces – Lindydancer Jun 17 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.