瀏覽代碼

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 10 年之前
父節點
當前提交
e42c161109
共有 1 個文件被更改,包括 5 次插入0 次删除
  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