Skip to content

Commit

Permalink
Fix the issue of adding before-save-hook globally
Browse files Browse the repository at this point in the history
  • Loading branch information
akirak committed Aug 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3ac2024 commit c2743ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions org-make-toc.el
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit c2743ae

Please sign in to comment.