Make hooks to set up extensions removable
Hi @nobiot!
@riscy suggested in this comment that hyperdrive-org-transclusion add hooks in a mode or setup function so that merely requiring the library doesn't irrevocably affect the Emacs runtime. After reading Chris's comment, I moved the add-hook form into a minor mode which can be disabled to remove the hook.
Would you be open to making a change like this in org-transclusion so that the built-in extensions can be enabled/disabled with autoloaded minor modes?
The downside I see is that the setup instructions would have to change. For example, setting up org-transclusion-indent-mode extension would require users to change
(with-eval-after-load 'org-transclusion
(add-to-list 'org-transclusion-extensions 'org-transclusion-indent-mode)
(require 'org-transclusion-indent-mode))
to
(with-eval-after-load 'org-transclusion
(org-transclusion-indent-mode +1))
I'm willing to draft a patchset. Are you open to such a breaking change?
Thank you!
Joseph
@josephmturner , Thank you for bringing this up. I agree with @riscy on "simply bringing your package in as a dependency shouldn't modify the Emacs runtime with an un-undoable add-hook." And I would have thought I was doing this -- it sounds like my lack of knowledge betrayed my intention.
Let me review my code in more detail and come back to you. In general, I am open to "breaking change"; but we may need a period where we support the "old way" in parallel, issue a warning, and keep it for 6-12 months.