diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 8d01eda71..824af69da 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -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."