From 008c76edc6f79cac3c987ec9ba84674bc89a4f85 Mon Sep 17 00:00:00 2001 Message-ID: <008c76edc6f79cac3c987ec9ba84674bc89a4f85.1717932899.git.yantar92@posteo.net> From: Ihor Radchenko Date: Sun, 9 Jun 2024 13:27:46 +0200 Subject: [PATCH] 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 6265a17fb..5af437497 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -18,6 +18,14 @@ Please send Org bug reports to mailto:emacs-orgmode@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 + +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 cf4c9a99e..0f3818504 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4741,7 +4741,8 @@ (defun org--safe-remote-resource-p (uri) (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 -- 2.45.1