Browse Source

ox-publish: Throw an error for external reference outside of publish

* lisp/ox-publish.el (org-publish-resolve-external-link): Throw an
  error when trying to resolve an external reference while not in
  a publishing process.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97420>
Nicolas Goaziou 4 years ago
parent
commit
e42c161109
1 changed files with 5 additions and 0 deletions
  1. 5 0
      lisp/ox-publish.el

+ 5 - 0
lisp/ox-publish.el

@@ -1144,6 +1144,11 @@ This function allows to resolve external links like:
   [[file.org::*fuzzy][description]]
   [[file.org::#custom-id][description]]
   [[file.org::fuzzy][description]]"
+  (unless org-publish-cache
+    (user-error
+     "Reference \"%s\" in file \"%s\" cannot be resolved without publishing"
+     search
+     file))
   (let ((references (org-publish-cache-get-file-property
 		     (expand-file-name file) :references nil t)))
     (cond