From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
Date: Mon, 19 Aug 2013 11:38:15 +0300 [thread overview]
Message-ID: <1376901495-17349-1-git-send-email-jani@nikula.org> (raw)
In reply, insert quotable parts using notmuch-show-insert-bodypart
instead of calling notmuch-mm-display-part-inline directly to render
the quoted parts as they are rendered in show view.
The notable change is that replies to text/calendar parts quote the
pretty printed output of icalendar-import-buffer rather than the ugly
raw vcalendar.
---
emacs/notmuch-mua.el | 7 ++++---
emacs/notmuch-show.el | 9 ++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baae5f..24b0d0f 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -130,9 +130,10 @@ list."
(defun notmuch-mua-insert-quotable-part (message part)
(save-restriction
(narrow-to-region (point) (point))
- (notmuch-mm-display-part-inline message part (plist-get part :id)
- (plist-get part :content-type)
- notmuch-show-process-crypto)
+ ;; We don't want hooks, such as notmuch-wash-*, to be run on the
+ ;; quotable part.
+ (let ((notmuch-show-insert-text/plain-hook nil))
+ (notmuch-show-insert-bodypart message part 0 nil t))
(goto-char (point-max))))
;; There is a bug in emacs 23's message.el that results in a newline
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 82b70ba..1fb48aa 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -874,7 +874,7 @@ message at DEPTH in the current thread."
;; showable this returns nil.
(notmuch-show-create-part-overlays button part-beg part-end))))
-(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
+(defun notmuch-show-insert-bodypart (msg part depth &optional hide quote)
"Insert the body part PART at depth DEPTH in the current thread.
If HIDE is non-nil then initially hide this part."
@@ -887,8 +887,11 @@ If HIDE is non-nil then initially hide this part."
content-type))
(nth (plist-get part :id))
(beg (point))
- ;; We omit the part button for the first (or only) part if this is text/plain.
- (button (unless (and (string= mime-type "text/plain") (<= nth 1))
+ ;; We omit the part button for the first (or only) part if
+ ;; this is text/plain, or we're inserting the part for
+ ;; quoting in reply.
+ (button (unless (or quote
+ (and (string= mime-type "text/plain") (<= nth 1)))
(notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
(content-beg (point)))
--
1.7.10.4
next reply other threads:[~2013-08-19 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 8:38 Jani Nikula [this message]
2013-08-23 14:50 ` [PATCH] emacs: insert quotable parts in reply as they are displayed in show view Mark Walters
-- strict thread matches above, loose matches on Subject: below --
2013-09-01 17:59 Jani Nikula
2013-09-01 18:03 ` Mark Walters
2013-09-01 18:13 ` Tomi Ollila
2013-09-05 9:42 ` David Bremner
2013-09-01 19:13 Austin Clements
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=1376901495-17349-1-git-send-email-jani@nikula.org \
--to=jani@nikula.org \
--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).