[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DISCUSSION] Add "Recent News" to orgmode.org
From: |
Ihor Radchenko |
Subject: |
Re: [DISCUSSION] Add "Recent News" to orgmode.org |
Date: |
Sun, 09 Jun 2024 11:36:25 +0000 |
Bastien Guerry <bzg@gnu.org> writes:
>> However, the page did not get updated. May you please check the build
>> logs? Is there anything fishy going on there?
>
> https://builds.sr.ht/~bzg/job/1246209 still says:
>
> "The remote resource "https://tracker.orgmode.org/news.org" is
> considered unsafe, and will not be downloaded."
>
> I've committed this:
>
> https://git.sr.ht/~bzg/orgweb/commit/f494af7c2f
>
> Perhaps there is a buggy combinaison of `org-resource-download-policy'
> and `org-safe-remote-resources' in general, in which case this needs
> to get fixed -- I didn't test further. If this does not work, I will
> have another look this afternoon.
I think that the old regexp was simply not accurate. In particular, the
trailing \' prohibited all the Urls other than literally
https://tracker.orgmode.org.
That said, it is annoying that Org mode did not provide a clear
indication that something is fishy other than a simple message.
Attaching tentative patch that makes Org mode throw an error when a
prompt is requested for an external URI.
>From 008c76edc6f79cac3c987ec9ba84674bc89a4f85 Mon Sep 17 00:00:00 2001
Message-ID:
<008c76edc6f79cac3c987ec9ba84674bc89a4f85.1717932899.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
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
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>