alphapapa / org-make-toc

Automatic tables of contents for Org-mode files
GNU General Public License v3.0
108 stars 18 forks source link

Added: org-make-toc-auto-toc feature + supporting changes #23

Closed trev-dev closed 2 years ago

trev-dev commented 2 years ago

This merge request includes the commits required to add a convenience feature feature that will allow a user to:

  1. Add a list of org files to a custom list
  2. Call a function in their init.el that will automatically set up an org-mode-hook function. This function will activate org-make-toc-mode if the buffer-file-name is in the custom list

I've been using this feature in my init for a while now and have not had any issues, and thought perhaps you might like it.

alphapapa commented 2 years ago

Hi,

Thanks for the offer, but that isn't generally the idiomatic way to do this in Emacs. Rather, one should use a file-local or directory-local variable to activate the mode in the desired files. For example, M-x add-file-local-variable RET eval RET org-make-toc-mode RET. Or one could add org-make-toc to the file's before-save-hook by the same method.

If a user really prefers to maintain a list of such files in his configuration, that would best be handled by bespoke code in the user's configuration rather than as part of this package.

trev-dev commented 2 years ago

Sounds good to me.