From: Jani Nikula <jani@nikula.org>
To: Jameson Graef Rollins <jrollins@finestructure.net>,
David Edmondson <dme@dme.org>,
notmuch@notmuchmail.org
Subject: Re: [PATCH v2 1/2] emacs: create patch filename from subject for inline patch fake parts
Date: Mon, 26 Dec 2011 23:52:23 +0200 [thread overview]
Message-ID: <87mxafq9uw.fsf@nikula.org> (raw)
In-Reply-To: <8739c7jcfo.fsf@servo.finestructure.net>
On Mon, 26 Dec 2011 12:38:35 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Mon, 26 Dec 2011 14:24:42 +0200, Jani Nikula <jani@nikula.org> wrote:
> > > Clicking on the button for the part saves the wrong thing, though,
> > > because it's not a real MIME part. That looks a bit awkward to fix, so
> > > perhaps you could still prefix the name with "inline: " to indicate that
> > > it's odd?
> >
> > I'm not sure I follow you here. Could you elaborate what you mean by
> > "the wrong thing", please?
>
> Yes, this is a problem/bug with the current behavior of these fake
> inline parts, actually. The button should behave as those it is
> representing an actual MIME part of the message. However, clicking the
> button saves the entire part that the fake part is derived from, rather
> than just the data in the fake part. This is countereintuitive and
> confusing.
Okay, thanks for the explanation. This might be beyond my elisp
skills. And IMHO out of the scope of the patch anyway.
> > I don't think the user would want to have an "inline: " prefix in the
> > filename that would have to be removed every time. I think that kind of
> > defeats the purpose here. Or where exactly are you proposing to have the
> > prefix?
>
> It's confusing to have this fake part button look just like a real part
> button, without any indication that it's really a fake part, and then to
> behave differently as well. The button needs some indication that it
> does not represent a real mime part of the message. Giving the fake
> part a proper filename is fine, but it needs some other indicator that
> the part is fake and that the button is not going to behave as expected.
Below is an idea I came up with, utilizing the content-type
vs. declared-type distinction. I think it's really simple and neat, but
I hope not too magical.
Picking up an example mail from the list, inline patches would show up
like this:
[ 0001-emacs-unify-search-mechanisms.patch: inline patch (as text/x-diff) ]
BR,
Jani.
From b1847714f7368247fbc5c93767f59d8269eadc1c Mon Sep 17 00:00:00 2001
From: Jani Nikula <jani@nikula.org>
Date: Mon, 26 Dec 2011 23:31:41 +0200
Subject: [PATCH] emacs: add inline patch fake parts through a special handler
Add wash generated inline patch fake parts through a special
"inline-patch-fake-part" handler to distinguish them from real MIME
parts. The fake parts are described as "inline patch (as text/x-diff)".
Signed-off-by: Jani Nikula <jani@nikula.org>
---
emacs/notmuch-show.el | 4 ++++
emacs/notmuch-wash.el | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index eee4da9..6ef3f90 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -585,6 +585,10 @@ current buffer, if possible."
nil))
nil))))
+;; Handler for wash generated inline patch fake parts.
+(defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)
+ (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))
+
(defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)
;; This handler _must_ succeed - it is the handler of last resort.
(notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 7d037f5..de51c88 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -351,7 +351,7 @@ for error."
(setq patch-end (match-beginning 0)))
(save-restriction
(narrow-to-region patch-start patch-end)
- (setq part (plist-put part :content-type "text/x-diff"))
+ (setq part (plist-put part :content-type "inline-patch-fake-part"))
(setq part (plist-put part :content (buffer-string)))
(setq part (plist-put part :id -1))
(setq part (plist-put part :filename
--
1.7.5.4
next prev parent reply other threads:[~2011-12-26 21:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-18 23:02 [PATCH] emacs: create patch filename from subject for inline patch fake parts Jani Nikula
2011-12-20 20:05 ` Jani Nikula
2011-12-20 20:11 ` Dmitry Kurochkin
2011-12-20 21:52 ` Austin Clements
2011-12-21 9:21 ` David Edmondson
2011-12-21 14:40 ` Austin Clements
2011-12-21 20:21 ` Jani Nikula
2011-12-25 22:00 ` [PATCH v2 0/2] emacs: patch filename from subject Jani Nikula
2011-12-25 22:00 ` [PATCH v2 1/2] emacs: create patch filename from subject for inline patch fake parts Jani Nikula
2011-12-26 12:06 ` David Edmondson
2011-12-26 12:24 ` Jani Nikula
2011-12-26 20:38 ` Jameson Graef Rollins
2011-12-26 21:52 ` Jani Nikula [this message]
2011-12-26 22:05 ` David Edmondson
2011-12-25 22:00 ` [PATCH v2 2/2] test: emacs: test notmuch-wash-subject-to-* functions Jani Nikula
2011-12-27 16:04 ` [PATCH v3 0/3] emacs: patch filename from subject Jani Nikula
2011-12-27 16:04 ` [PATCH v3 1/3] emacs: add inline patch fake parts through a special handler Jani Nikula
2011-12-27 16:04 ` [PATCH v3 2/3] emacs: create patch filename from subject for inline patch fake parts Jani Nikula
2011-12-27 16:04 ` [PATCH v3 3/3] test: emacs: test notmuch-wash-subject-to-* functions Jani Nikula
2011-12-28 12:22 ` [PATCH v3 0/3] emacs: patch filename from subject 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=87mxafq9uw.fsf@nikula.org \
--to=jani@nikula.org \
--cc=dme@dme.org \
--cc=jrollins@finestructure.net \
--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).