From 87b4de961709077806eef6509138281ab6b6d03b Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 5 Aug 2023 13:57:45 +0300 Subject: [PATCH] org-publish-resolve-external-link: Fix links to non-Org files * lisp/ox-publish.el: Do not try to call `org-at-heading-p' when not in Org file. `org-at-heading-p' and `org-entry-get' may err unless inside Org buffer. --- lisp/ox-publish.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index f9c3877d7..cff34f058 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -1183,7 +1183,8 @@ references with `org-export-get-reference'." (org-link-search search nil t) (error (signal 'org-link-broken (cdr err))))) - (and (org-at-heading-p) + (and (derived-mode-p 'org-mode) + (org-at-heading-p) (org-string-nw-p (org-entry-get (point) "CUSTOM_ID")))))))) ((not org-publish-cache) (progn