reddit / emacs

Should this package ship with a minor-mode or a derived major-mode?

a-c-d-w · 2022-04-24 23:59
*Note: the question comes below, I do apologize if this explanation isn't clear. Let me know if you have any questions!* I've been working on a series of functions for `org-mode` that make it easier to work with task items with sub-headings. I've called it [org-taskwise](https://github.com/duckwork/org-taskwise.el) and even though it's still fairly lightweight, I'm getting a good amount of use out of it so far. Of course, these functions are not generally applicable to every org file I may write, though on the files that I want to use these functions, I want to overwrite some org-mode functionality with the functionality in this package. There is also functionality that does not need to overwrite org-mode functionality, but that complements it. E.g., the function `org-taskwise-narrow-to-task` *complements* other narrowing functions, like `org-narrow-to-subtree`. Therefore, I don't want to shadow the binding for `org-narrow-to-subtree`---instead, I bind `org-taskwise-narrow-to-task` to `C-x n t`. However, when I go to *archive* a task (`C-c C-x a`), I hardly ever want to archive the heading I'm under currently, but rather the overarching task that the heading is a part of. So I want to shadow its binding with `org-taskwise-archive` (which I haven't written yet, but it's trivial to do). My question is this: For a package with functionality that both *complements* and *modifies* default Emacs functionality, like `org-taskwise.el` does, is it a better idea to make `org-taskwise-mode` a minor mode, or a major mode derived from `org-mode`? As of right now, I'm thinking most of my customizations will be in keybindings for the minor mode, and while that may be expanded, I don't forsee any need for extra syntax highlighting over what `org-mode` already does. I'm asking because it feels like it *could* be a minor-mode, except that it's extremely file-dependent; it might be nice to simply include `-*- org-taskwise -*-` at the top of the file instead of an `eval: (org-taskwise-mode +1)` in a local variable block. I'd love to hear what r/emacs thinks!
nv-elisp · 2022-04-25 07:50
Sounds like a minor mode to me. And I would leave the bindings to the user. You may want to shadow the archiving binding, but others may not.
Phil-Hudson · 2022-04-25 14:20
Unless there's a file type, indicated by filename extension, that always specifically uses/needs your mode, then I'd say it's probably a minor mode.