mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-26 07:33:39 +00:00
org-attach-tag: Work around error when before first heading
* lisp/org-attach.el (org-attach-tag): Avoid error thrown when trying to set tags before first heading. This is not a proper fix, but it will at least allow attaching files to Org file. The tagging will be skipped for now, until setting FILETAGS is supported by Org API.
This commit is contained in:
parent
7e75571f02
commit
f067a4bd43
@ -513,9 +513,13 @@ DIR-property exists (that is different from the unset one)."
|
||||
(defun org-attach-tag (&optional off)
|
||||
"Turn the autotag on or (if OFF is set) off."
|
||||
(when org-attach-auto-tag
|
||||
(save-excursion
|
||||
(org-back-to-heading t)
|
||||
(org-toggle-tag org-attach-auto-tag (if off 'off 'on)))))
|
||||
;; FIXME: There is currently no way to set #+FILETAGS
|
||||
;; programatically. Do nothing when before first heading
|
||||
;; (attaching to file) to avoid blocking error.
|
||||
(unless (org-before-first-heading-p)
|
||||
(save-excursion
|
||||
(org-back-to-heading t)
|
||||
(org-toggle-tag org-attach-auto-tag (if off 'off 'on))))))
|
||||
|
||||
(defun org-attach-untag ()
|
||||
"Turn the autotag off."
|
||||
|
Loading…
Reference in New Issue
Block a user