From: "W. Trevor King" <wking@tremily.us>
To: notmuch@notmuchmail.org
Subject: [RFC] Content-Description when naming MIME parts in Emacs mode
Date: Sun, 2 Feb 2014 12:46:17 -0800 [thread overview]
Message-ID: <20140202204616.GD14197@odin.tremily.us> (raw)
[-- Attachment #1: Type: text/plain, Size: 3309 bytes --]
On the rss2email list, Victor Orlikowski pointed out [1] that a number
of MUAs don't use the Subject header of attached message/rfc822 parts
to label multipart/digest subparts [2]. Instead, notmuch and several
other MUAs use the filename parameter [3] as a content hint [4].
Using the filename parameter seems more sane than diving into the
message/rfc822 part header, but that's still not what the filename
parameter was designed for. It makes more sense to me to use the
message/rfc822 part's Content-Description header [5,6], falling back
on the filename parameter if Content-Description isn't set.
It's pretty easy to patch notmuch-show-insert-bodypart to do this:
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1ac80ca..485c7d1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -874,13 +874,16 @@ useful for quoting in replies)."
content-type))
(nth (plist-get part :id))
(beg (point))
+ (name (if (plist-get part :content-description)
+ (plist-get part :content-description)
+ (plist-get part :filename)))
;; Hide the part initially if HIDE is t.
(show-part (not (equal hide t)))
;; We omit the part button for the first (or only) part if
;; this is text/plain, or HIDE is 'no-buttons.
(button (unless (or (equal hide 'no-buttons)
(and (string= mime-type "text/plain") (<= nth 1)))
- (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
+ (notmuch-show-insert-part-header nth mime-type content-type name)))
(content-beg (point)))
;; Store the computed mime-type for later use (e.g. by attachment handlers).
But that doesn't work, because :content-description doesn't exist in
the part plist. I've looked through the source for a bit and can't
figure out where that part plist is coming from. Is it loaded from
notmuch output in notmuch-show-build-buffer? I assume that
information comes from the index, in which case I'd need to tweak
_index_mime_part in lib/index.cc to add the description. Indexing
descriptions seems like a generally useful thing, even outside of my
digest usecase (e.g. search image/jpeg attachements with “genome” in
their description [6]). However, adding a field to the schema is more
invasive than changing the Emacs mode's attachment formatting; I
thought I should check in here for feedback and advice before wading
in with my —a̶x̶e̶— scalpel ;).
Thoughs?
Trevor
[1]: http://article.gmane.org/gmane.mail.rss2email/211
[2]: Digests: http://tools.ietf.org/html/rfc2046#section-5.1.5
[3]: Filename: http://tools.ietf.org/search/rfc2183#section-2.3
[4]: Filename hint to notmuch-show-insert-part-header:
http://git.notmuchmail.org/git/notmuch/blob/HEAD:/emacs/notmuch-show.el#l883
[5]: Content-Desciption:
http://tools.ietf.org/html/rfc2045#section-8
[6]: Content-Description examples:
http://tools.ietf.org/html/rfc2183#section-3
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next reply other threads:[~2014-02-02 20:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-02 20:46 W. Trevor King [this message]
2014-02-02 23:33 ` [RFC] Content-Description when naming MIME parts in Emacs mode David Bremner
2014-02-03 8:04 ` Mark Walters
2014-02-03 10:45 ` [PATCH 0/2] W. Trevor King
2014-02-03 10:45 ` [PATCH 1/2] notmuch-show: Add content-description output pair W. Trevor King
2014-02-03 10:45 ` [PATCH 2/2] emacs: Prefer Content-Description over filename for part buttons W. Trevor King
2014-02-03 20:15 ` Mark Walters
2014-02-03 20:34 ` W. Trevor King
2014-02-04 1:32 ` W. Trevor King
2014-02-08 12:55 ` David Bremner
2014-02-08 16:59 ` W. Trevor King
2014-02-09 10:10 ` Mark Walters
2014-02-09 12:53 ` David Bremner
2014-02-08 17:33 ` W. Trevor King
2014-02-09 10:17 ` Mark Walters
2014-02-03 20:44 ` Tomi Ollila
2014-02-04 0:14 ` W. Trevor King
2014-02-04 10:31 ` Tomi Ollila
2014-02-03 14:24 ` [PATCH 0/2] David Bremner
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://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140202204616.GD14197@odin.tremily.us \
--to=wking@tremily.us \
--cc=notmuch@notmuchmail.org \
/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://yhetil.org/notmuch.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).