rougier / nano-modeline

GNU Emacs / N Λ N O Modeline
GNU General Public License v3.0
175 stars 31 forks source link

make available modelines more dynamic #25

Closed hans-d closed 2 years ago

hans-d commented 2 years ago

Making the various modeline formats something configurable instead of hardcoded:

hans-d commented 2 years ago

@rougier can you already have a look? Doing some tests to see all behaves (but I don't have all modes)

rougier commented 2 years ago

Sorry for late answer. I may need some time to understand what you propose but it looks good. Can you elaborate a bit here on the whole idea?

hans-d commented 2 years ago

The main bit is from: https://github.com/rougier/nano-modeline/pull/25/files?diff=unified&w=0#diff-d8d7595c6cf463b5cac5576faf0ab2b09ea28c112993a655f1c9bbbb6331cbe5L732, and https://github.com/rougier/nano-modeline/pull/25/files#diff-d8d7595c6cf463b5cac5576faf0ab2b09ea28c112993a655f1c9bbbb6331cbe5L862

In the current situation, nano-modeline has knowlegde of the various defined modelines. Eg a hardcoded list of possible modelines and all the related hooks that need to be added/removed.

In this change, nano-modeline has no specific knowledge, but only provides an extension point via nano-modeline-mode-formats.

This allows for adding multiple new modelines, eg via various packages, instead of a local construct that needs to combine them in usermode. (just and att to list) It also allows to get rid of various modelines that come out of the box by just setting the list with the wanted modes, or override an existing modeline.

For now I've added all the current provided modelines to keep the current behaviour.

I can imagine that eg mu4e related modelines are moved to a separate/optional package, so that the default set is more restricted while still allowing these modelines to be added in a simple way. This allows for the general functionality (and release) of nano-modeline to be decoupled from the various modeline formats.

rougier commented 2 years ago

Thanks a lot. It's really a nice addition and it may be also probably faster. Could you get rid of the tabs in your code before merging?

hans-d commented 2 years ago

cleaned up (but haven't got merge powers)

rougier commented 2 years ago

Thanks a lot for this contribution. I've merged and bumped the version to 0.5 I think the user mode is not longer necessary since it is now a matter of prepending a an item in the formats list.