From 698c52f7c1f3c5f8e0d58f420108fdfb26199936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20Karata=C5=9F?= Date: Wed, 8 Jul 2020 21:20:11 +0300 Subject: [PATCH 1/2] Add a variable to hide body of the TOC after inserting new contents --- toc-org.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toc-org.el b/toc-org.el index f519b20..e7eb2c5 100644 --- a/toc-org.el +++ b/toc-org.el @@ -115,6 +115,12 @@ the TOC links (even if the style is different from org)." :type 'boolean :group 'toc-org) +(defcustom toc-org-insert-silently nil + "If non-nil, hide body of the table of contents after inserting +new contents." + :type 'boolean + :group 'toc-org) + (defvar-local toc-org-hrefify-hash nil "Buffer local hash-table that is used to enable links opening. The keys are hrefified headings, the values are original @@ -444,7 +450,8 @@ not :noexport_#:." (buffer-substring-no-properties beg end) new-toc) (delete-region beg end) - (insert new-toc))))) + (insert new-toc) + (if toc-org-insert-silently (outline-hide-body)))))) (message (concat "Hrefify function " hrefify-string " is not found")))))))) (defun toc-org-follow-markdown-link () From 99d233269a64715f687eb6be1310a4458930d467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20Karata=C5=9F?= Date: Thu, 9 Jul 2020 11:14:33 +0300 Subject: [PATCH 2/2] Change the hide function to proper one --- toc-org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toc-org.el b/toc-org.el index e7eb2c5..b350d57 100644 --- a/toc-org.el +++ b/toc-org.el @@ -451,7 +451,7 @@ not :noexport_#:." new-toc) (delete-region beg end) (insert new-toc) - (if toc-org-insert-silently (outline-hide-body)))))) + (if toc-org-insert-silently (outline-hide-entry)))))) (message (concat "Hrefify function " hrefify-string " is not found")))))))) (defun toc-org-follow-markdown-link ()