From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 5/5] emacs: Use message-citation-line-format in reply
Date: Tue, 17 Jan 2012 15:53:38 -0700 [thread overview]
Message-ID: <1326840818-6821-2-git-send-email-awg+notmuch@xvx.ca> (raw)
In-Reply-To: <1326840818-6821-1-git-send-email-awg+notmuch@xvx.ca>
Instead of using a static citation line for the first line of the
reply message, use the customizable one defined by message-mode.
This makes it easy for users to customize the reply style, and
retains consistency for users with existing message-mode
customizations.
The test has been updated to reflect how the message will be
formatted with the default value of message-citation-line-format.
---
emacs/notmuch-mua.el | 19 ++++++++++++++++---
test/emacs | 2 +-
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 64e160a..b58f919 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -135,9 +135,22 @@ list."
(forward-line -1)
(goto-char (point-max)))
- (insert (format "On %s, %s wrote:\n"
- (cdr (assq 'date original-headers))
- (cdr (assq 'from original-headers))))
+ (let* ((quoth message-citation-line-format)
+ (case-fold-search nil)
+ (full-from (cdr (assq 'from original-headers)))
+ (from-addr (car (mail-header-parse-address full-from)))
+ (from-name (cdr (mail-header-parse-address full-from)))
+ (first-name (car (split-string from-name)))
+ (last-name (append (cdr (split-string from-name))))
+ (time (date-to-time (cdr (assq 'date original-headers)))))
+
+ (setq quoth (replace-regexp-in-string "%f" full-from quoth t t))
+ (setq quoth (replace-regexp-in-string "%n" from-addr quoth t t))
+ (setq quoth (replace-regexp-in-string "%N" from-name quoth t t))
+ (setq quoth (replace-regexp-in-string "%F" first-name quoth t t))
+ (setq quoth (replace-regexp-in-string "%L" last-name quoth t t))
+ (setq quoth (format-time-string quoth time))
+ (insert quoth))
(if plain-parts
(mapc (lambda (part) (notmuch-mua-insert-part-quoted part)) plain-parts)
diff --git a/test/emacs b/test/emacs
index ac47b16..3f59b23 100755
--- a/test/emacs
+++ b/test/emacs
@@ -268,7 +268,7 @@ Subject: Re: Testing message sent via SMTP
In-Reply-To: <XXX>
Fcc: $(pwd)/mail/sent
--text follows this line--
-On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+On Sat, Jan 01 2000, Notmuch Test Suite wrote:
> This is a test that messages are sent via SMTP
EOF
test_expect_equal_file OUTPUT EXPECTED
--
1.7.5.4
next prev parent reply other threads:[~2012-01-17 22:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 18:13 [PATCH v2 0/4] Quoting HTML Emails in Reply Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 1/4] test: Add broken test for the new JSON reply format Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 2/4] reply: Add a " Adam Wolfe Gordon
2012-01-18 23:07 ` Jani Nikula
2012-01-18 23:29 ` Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 3/4] man: Update notmuch-reply man page for JSON format Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 4/4] emacs: Use the new JSON reply format Adam Wolfe Gordon
2012-01-17 9:04 ` David Edmondson
2012-01-17 16:18 ` Adam Wolfe Gordon
2012-01-17 22:53 ` [PATCH v2 4/5] " Adam Wolfe Gordon
2012-01-17 22:53 ` Adam Wolfe Gordon [this message]
2012-01-18 6:54 ` David Edmondson
2012-01-18 16:29 ` Adam Wolfe Gordon
2012-01-18 16:32 ` Adam Wolfe Gordon
2012-01-18 16:41 ` David Edmondson
2012-01-18 17:08 ` Adam Wolfe Gordon
2012-01-17 1:18 ` [PATCH v2 5/4] emacs: Add customization for the first line of quotes Adam Wolfe Gordon
2012-01-17 7:17 ` how about message-citation-line-format (was: Re: [PATCH v2 5/4] emacs: Add customization for the first line of quotes.) Gregor Zattler
2012-01-17 9:05 ` David Edmondson
2012-01-17 16:20 ` Adam Wolfe Gordon
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=1326840818-6821-2-git-send-email-awg+notmuch@xvx.ca \
--to=awg+notmuch@xvx.ca \
--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).