2

Have got some elisp functions. When is it proper to include them in a minor-mode rather than using just a simple elisp file.

What functionality do minor modes provide that cannot be achieved with simply loading a file?

9
  • 1
    The question is too broad, and encourages opinion-based answers. Can you ask something more specific about the use or behavior of minor modes? E.g., is there something specific about them that you don't understand or want to know more about?
    – Drew
    Jun 15, 2022 at 0:51
  • I am starting to think that ending up with many minor-modes could be counter-productive. What features can minor-modes provide that makes one want to use them, rather than using a simple elisp file? Got some functionality that one would want to have enabled for all major modes, perhaps these general things do not specifically require a minor-mode declaration.
    – Dilna
    Jun 15, 2022 at 1:38
  • 1
    Have you read the "Major and Minor Modes" chapter in the Elisp manual?
    – NickD
    Jun 15, 2022 at 2:45
  • I know what they are. My conclusion has been that minor modes are easy to turn "on" or "off". But besides that I can have the same functionality from just an el file.
    – Dilna
    Jun 15, 2022 at 3:24
  • 1
    I don't really understand your point: minor modes are just el files after all. It's just that they are not a catch-all of random functions (however useful those might be): there is an underlying unity in what they provide. If you cannot describe what the functions in your el file collectively help to do in a single sentence, then don't bother making them into a minor mode. But that's hopelessly vague, e.g. "They help me be more productive" is a single sentence, but that's not helpful :-). In any case, I agree with @Drew: the question is too broad for this site.
    – NickD
    Jun 15, 2022 at 15:09

1 Answer 1

2

A minor mode provides a switch. Often adds or removes hooks. Provides an own keymap. Think at abbrev-mode or whitespace-mode. It's a kind of grouping. For a certain feature, which is useful, but not all the time, so switch it off or on.

1
  • Very clear and helpful explanation,
    – Dilna
    Jun 15, 2022 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.