Skip to content

Commit

Permalink
Merge: (org-make-toc-mode) Add to local before-save-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
alphapapa committed Aug 30, 2024
2 parents 3ac2024 + 7a4c619 commit 56d8c66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Because of the way GitHub renders Org documents and links, it's not possible to

+ Tolerate whitespace before drawer opening/closing lines. ([[https://github.com/alphapapa/org-make-toc/pull/15][#15]], [[https://github.com/alphapapa/org-make-toc/issues/17][#17]]. Thanks to [[https://github.com/progfolio][Nicholas Vollmer]].)
+ Link-type function called with position as argument. (Fixes occasional bugs with heading IDs.)
+ Mode ~org-make-toc-mode~ now adds to the ~before-save-hook~ in the local buffer rather than globally. ([[https://github.com/alphapapa/org-make-toc/pull/24][#24]]. Thanks to [[https://github.com/akirak][Akira Komamura]].)

** 0.5

Expand Down
5 changes: 3 additions & 2 deletions org-make-toc.el
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,9 @@ With prefix argument ARG, turn on if positive, otherwise off."
:init-value nil
(unless (derived-mode-p 'org-mode)
(user-error "Not an Org buffer"))
(funcall (if org-make-toc-mode #'add-hook #'remove-hook)
'before-save-hook #'org-make-toc)
(if org-make-toc-mode
(add-hook 'before-save-hook #'org-make-toc nil t)
(remove-hook 'before-save-hook #'org-make-toc t))
(message (format "org-make-toc-mode %s."
(if org-make-toc-mode
"enabled"
Expand Down

0 comments on commit 56d8c66

Please sign in to comment.