From c2743ae700ab703ef2f72732d35a56dda749e27d Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Sat, 13 Aug 2022 17:51:12 +0900 Subject: [PATCH 1/2] Fix the issue of adding before-save-hook globally --- org-make-toc.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org-make-toc.el b/org-make-toc.el index 3459423..e1942a9 100644 --- a/org-make-toc.el +++ b/org-make-toc.el @@ -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" From 7a4c6191ca87efa7d577eadf93440ef58ebd6025 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Fri, 30 Aug 2024 15:40:39 -0500 Subject: [PATCH 2/2] Docs: Update changelog --- README.org | 1 + 1 file changed, 1 insertion(+) diff --git a/README.org b/README.org index ef8904b..9443e56 100644 --- a/README.org +++ b/README.org @@ -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