* bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10)
@ 2021-11-04 10:35 Arash Esbati
2021-11-04 11:08 ` Gregory Heytings
0 siblings, 1 reply; 4+ messages in thread
From: Arash Esbati @ 2021-11-04 10:35 UTC (permalink / raw)
To: 51600
Hi all,
I slightly changed the entry for "application/pdf" in my ~/.mailcap and
while trying out the result, I see that Emacs overrules my entries when
I start Gnus and write a message. I'm on Win10 where for example I have
these 2 entries in ~/.mailcap:
application/ms-tnef; wmopener.exe "%s"
application/pdf; start AcroRd32.exe %s
When I start Emacs and eval these forms in *scratch*, I get:
(mailcap-mime-info "application/pdf")
"start AcroRd32.exe %s"
(mailcap-mime-info "application/ms-tnef")
"wmopener.exe \"%s\""
As I'm writing this message, I get:
(mailcap-mime-info "application/pdf")
doc-view-mode
(mailcap-mime-info "application/ms-tnef")
nil
It used to work for me for a long time, so I suspect something went
wrong (at least for Windows) after this commit: daea9b3b44
Can others reproduce this?
Best, Arash
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10)
2021-11-04 10:35 bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10) Arash Esbati
@ 2021-11-04 11:08 ` Gregory Heytings
2021-11-04 17:48 ` Lars Ingebrigtsen
2021-11-04 19:04 ` Arash Esbati
0 siblings, 2 replies; 4+ messages in thread
From: Gregory Heytings @ 2021-11-04 11:08 UTC (permalink / raw)
To: Arash Esbati; +Cc: 51600
[-- Attachment #1: Type: text/plain, Size: 381 bytes --]
>
> When I start Emacs and eval these forms in *scratch*, I get:
>
> (mailcap-mime-info "application/pdf")
> "start AcroRd32.exe %s"
>
> (mailcap-mime-info "application/ms-tnef")
> "wmopener.exe \"%s\""
>
> As I'm writing this message, I get:
>
> (mailcap-mime-info "application/pdf")
> doc-view-mode
>
> (mailcap-mime-info "application/ms-tnef")
> nil
>
Indeed. Patch attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Reset-mailcap-entries-only-when-mailcap-files-are-re.patch, Size: 2077 bytes --]
From 6c004a0516ddc8d4323cfef6fbc2839e624ca811 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Thu, 4 Nov 2021 11:04:11 +0000
Subject: [PATCH] Reset mailcap entries only when mailcap files are read again.
* lisp/net/mailcap.el (mailcap-parse-mailcaps): Move the clear and
load defaults operations at their appropriate place. Fixes bug#51600.
---
lisp/net/mailcap.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index e40cf2a336..df6bdd1aba 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -423,14 +423,6 @@ mailcap-parse-mailcaps
(interactive (list nil t))
(when (or (not mailcap-parsed-p)
force)
- ;; Clear out all old data.
- (setq mailcap--computed-mime-data nil)
- ;; Add the Emacs-distributed defaults (which will be used as
- ;; fallbacks). Do it this way instead of just copying the list,
- ;; since entries are destructively modified.
- (cl-loop for (major . minors) in mailcap-mime-data
- do (cl-loop for (minor . entry) in minors
- do (mailcap-add-mailcap-entry major minor entry)))
(cond
(path nil)
((getenv "MAILCAPS")
@@ -450,6 +442,14 @@ mailcap-parse-mailcaps
(when (seq-some (lambda (f)
(file-has-changed-p (car f) 'mail-parse-mailcaps))
path)
+ ;; Clear out all old data.
+ (setq mailcap--computed-mime-data nil)
+ ;; Add the Emacs-distributed defaults (which will be used as
+ ;; fallbacks). Do it this way instead of just copying the list,
+ ;; since entries are destructively modified.
+ (cl-loop for (major . minors) in mailcap-mime-data
+ do (cl-loop for (minor . entry) in minors
+ do (mailcap-add-mailcap-entry major minor entry)))
;; The ~/.mailcap entries will end up first in the resulting data.
(dolist (spec (reverse
(if (stringp path)
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10)
2021-11-04 11:08 ` Gregory Heytings
@ 2021-11-04 17:48 ` Lars Ingebrigtsen
2021-11-04 19:04 ` Arash Esbati
1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-04 17:48 UTC (permalink / raw)
To: Gregory Heytings; +Cc: Arash Esbati, 51600
Gregory Heytings <gregory@heytings.org> writes:
> Indeed. Patch attached.
Thanks; applied to Emacs 29.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10)
2021-11-04 11:08 ` Gregory Heytings
2021-11-04 17:48 ` Lars Ingebrigtsen
@ 2021-11-04 19:04 ` Arash Esbati
1 sibling, 0 replies; 4+ messages in thread
From: Arash Esbati @ 2021-11-04 19:04 UTC (permalink / raw)
To: Gregory Heytings; +Cc: 51600
Gregory Heytings <gregory@heytings.org> writes:
> Indeed. Patch attached.
Thanks for the quick fix, works as expected.
Best, Arash
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-04 19:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-04 10:35 bug#51600: 29.0.50; Entries in ~/.mailcap are overruled (Win10) Arash Esbati
2021-11-04 11:08 ` Gregory Heytings
2021-11-04 17:48 ` Lars Ingebrigtsen
2021-11-04 19:04 ` Arash Esbati
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.