-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make org-make-toc error message less intrusive #14
Comments
At what's start? If the user calls For that reason, I don't recommend adding the mode to If you prefer to do it the other way, you could modify or advise the relevant code in various ways in your personal Emacs configuration. |
I mean a I think the presence of such drawer is enough indication that I'd like the TOC to be updated, and vice versa: if there's no such drawer then there's nothing to update.
I have some code to insert meaningful anchors ( Cheers! |
As I said, if the user calls
Yes. See https://github.com/alphapapa/org-make-toc#automatically-update-on-save
See https://github.com/alphapapa/org-make-toc#automatically-update-on-save
I don't understand what you mean. |
That's what I've done and I get the error IMHO when called from I don't see an easy way to fix it with defadvice, so I currently use this code: (require 'org-make-toc)
(remove-hook 'org-mode-hook 'org-make-toc-mode)
(remove-hook 'before-save-hook 'org-make-toc)
(add-hook 'before-save-hook 'va/org-make-toc)
(defun va/org-make-toc ()
"Make or update table of contents in current buffer."
(interactive)
(when (eq major-mode 'org-mode)
(save-excursion
(goto-char (point-min))
(cl-loop for pos = (org-make-toc--next-toc-position)
while pos
do (progn
(goto-char pos)
(org-make-toc--update-toc-at-point))))))
(defun va/org-toc-insert ()
"Make TOC at current position. org-make-toc-insert asks too many questions"
(interactive)
(unless (org-find-exact-headline-in-buffer "Table of Contents")
(org-first-headline-recenter)
(beginning-of-line)
(insert "* Table of Contents :TOC:noexport:
:PROPERTIES:
:TOC: :include all
:END:
:CONTENTS:
:END:
"))) |
You get the message when saving any non-Org file? Do you mean that you added it to your global
You are not supposed to add the function to your global |
For most of my docs I use this mode so I set
But not for all... In that case I get this error on every save, which is annoying:
Is there a way to make
org-make-toc
check whether there's a:CONTENTS:
drawer at its start and if not, give up silently?The text was updated successfully, but these errors were encountered: