branch: externals/org commit ea4a690c1ac88d903124e3384ad7d2ead0f54f5e Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
org--confirm-resource-safe: Throw an error when non-interactive * lisp/org.el (org--confirm-resource-safe): When asking about resource safety in non-interactive mode throw an error rather than silently not downloading the resource. The previous behavior may remote #+include's seemingly being ignored. * etc/ORG-NEWS (Org mode may throw an error when attempting to include remote unsafe resource): Announce the change. --- etc/ORG-NEWS | 8 ++++++++ lisp/org.el | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 6265a17fb2..ec28f77d8d 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -18,6 +18,14 @@ Please send Org bug reports to mailto:emacs-orgm...@gnu.org. # require user action for most Org mode users. # Sorted from most important to least important. +*** Org mode may throw an error when attempting to include remote unsafe resource noninteractively + +Previously, when ~org-resource-download-policy~ is ~ask~ (default), +and Emacs is running in batch mode, Org mode simply skipped unsafe +remote resources in the =#+include:='s. Now, an error is thrown to +avoid seemingly ignored =#+include= statements when publishing via +batch scripts. + ** New features # We list the most important features, and the features that may diff --git a/lisp/org.el b/lisp/org.el index f28d786716..a727707c6a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4741,7 +4741,8 @@ returns non-nil if any of them match." (defun org--confirm-resource-safe (uri) "Ask the user if URI should be considered safe, returning non-nil if so." - (unless noninteractive + (if noninteractive + (error "Cannot prompt about %S interactively in batch mode. Aborting" uri) (let ((current-file (and (buffer-file-name (buffer-base-buffer)) (file-truename (buffer-file-name (buffer-base-buffer))))) (domain (and (string-match