From: Davide Masserut via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 65872@debbugs.gnu.org
Subject: bug#65872: [PATCH] Fix interactive display of MIME parts
Date: Mon, 11 Sep 2023 19:24:14 +0200 [thread overview]
Message-ID: <87a5tsoc75.fsf@mssdvd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
Tags: patch
This patch fixes a bug that did not allow to view attachments after
choosing to display them within Emacs.
The issue is in mm-interactively-view-part, which is used by
gnus-article-interactively-view-part and
notmuch-show-interactively-view-part.
mailcap-mime-info may return a list of functions or strings containing
external commands. This list is passed to completing-read, which always
returns a string.
Before this change, when the method is a string, mm-display-external
would have attempted to execute it through a shell even when the method
refers to an Elisp function.
I discovered this bug while using notmuch with
notmuch-show-part-button-default-action set to
#'notmuch-show-interactively-view-part and having tried to open a pdf
with doc-view-mode. This bug should also be reproducible using Gnus
but I don't know how to do it.
In GNU Emacs 30.0.50 (build 24, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.17.8) of 2023-09-11 built on T480s
Repository revision: b3ef1d67919261c3af3e12c14f3d66c4d156cc19
Repository branch: master
System Description: Arch Linux
Configured using:
'configure -C --prefix /home/davide/.local --with-pgtk
--with-native-compilation --enable-link-time-optimization
--enable-locallisppath=/usr/share/emacs/site-lisp/
'CFLAGS=-march=native -O2''
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-interactive-display-of-MIME-parts.patch --]
[-- Type: text/patch, Size: 1283 bytes --]
From 9f45d1b4c06bea2ffca7f7575f7600e8530b3814 Mon Sep 17 00:00:00 2001
From: Davide Masserut <dm@mssdvd.com>
Date: Mon, 11 Sep 2023 16:49:21 +0200
Subject: [PATCH] Fix interactive display of MIME parts
mailcap-mime-info may return a list of functions or strings containing
external commands. This list is passed to completing-read, which
always returns a string.
Before this change, when the method is a string, mm-display-external
would have attempted to execute it through a shell even when the
method refers to an Elisp function.
* lisp/gnus/mm-decode.el (mm-interactively-view-part): When method
contains a valid symbol, extract it using intern.
---
lisp/gnus/mm-decode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index b9beedf6c5c..1f91491afa1 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1501,7 +1501,7 @@ mm-interactively-view-part
(when (string= method "")
(error "No method given"))
(if (string-match "^[^% \t]+$" method)
- (setq method (concat method " %s")))
+ (setq method (or (intern-soft method) (concat method " %s"))))
(mm-display-external handle method)))
(defun mm-preferred-alternative (handles &optional preferred)
--
2.42.0
reply other threads:[~2023-09-11 17:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5tsoc75.fsf@mssdvd.com \
--to=bug-gnu-emacs@gnu.org \
--cc=65872@debbugs.gnu.org \
--cc=dm@mssdvd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).