From df4c1b5be769effb2ef7bc85c8bb8e09fb8f43fc Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 12 Mar 2025 06:36:21 -0300 Subject: [PATCH] Set 'untrusted-content' to t in all modes Instead of trying to guess in which modes this is safe not to set in, let's just set it in all of them. Background (added by db): untrusted-content was added in Emacs 29.3 and is currently set by Gnus and used by org-mode to prevent certain unsafe operations. I think the intent is to use it for blocking more unsafe operations in the future. --- emacs/notmuch-hello.el | 4 +++- emacs/notmuch-mua.el | 4 +++- emacs/notmuch-show.el | 2 ++ emacs/notmuch-tree.el | 2 ++ emacs/notmuch.el | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 15ba7c78..67c805a8 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -760,7 +760,9 @@ The screen may be customized via `\\[customize]'. Complete list of currently available key bindings: \\{notmuch-hello-mode-map}" - (setq notmuch-buffer-refresh-function #'notmuch-hello-update)) + (setq notmuch-buffer-refresh-function #'notmuch-hello-update) + (when (boundp 'untrusted-content) + (setq untrusted-content t))) ;;; Inserters diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index a75b0f5c..74c62aaf 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -379,7 +379,9 @@ Typically this is added to `notmuch-mua-send-hook'." (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" "Notmuch message composition mode. Mostly like `message-mode'." - (notmuch-address-setup)) + (notmuch-address-setup) + (when (boundp 'untrusted-content) + (setq untrusted-content t))) (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 921c0ef1..8a8e6a7b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1696,6 +1696,8 @@ All currently available key bindings: (setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view) (setq buffer-read-only t) (setq truncate-lines t) + (when (boundp 'untrusted-content) + (setq untrusted-content t)) (setq imenu-prev-index-position-function #'notmuch-show-imenu-prev-index-position-function) (setq imenu-extract-index-name-function diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 301ffd6e..aa0d92a7 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1095,6 +1095,8 @@ Complete list of currently available key bindings: (hl-line-mode 1)) (setq buffer-read-only t) (setq truncate-lines t) + (when (boundp 'untrusted-content) + (setq untrusted-content t)) (when notmuch-tree-outline-enabled (notmuch-tree-outline-mode 1))) (defvar notmuch-tree-process-exit-functions nil diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 5477bf4a..29b2a9ed 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -416,6 +416,8 @@ Complete list of currently available key bindings: (add-to-invisibility-spec (cons 'ellipsis t)) (setq truncate-lines t) (setq buffer-read-only t) + (when (boundp 'untrusted-content) + (setq untrusted-content t)) (setq imenu-prev-index-position-function #'notmuch-search-imenu-prev-index-position-function) (setq imenu-extract-index-name-function -- 2.45.2