From: Aaron Ecay <ecay@sas.upenn.edu>
To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3 5/5] emacs: Use message-citation-line-format in reply
Date: Thu, 19 Jan 2012 13:45:12 -0500 [thread overview]
Message-ID: <m2k44n4jlz.fsf@wal122.wireless-pennnet.upenn.edu> (raw)
In-Reply-To: <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca>
On Thu, 19 Jan 2012 10:46:57 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> 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.
> ---
> 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 5ae0ccf..e485d93 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -134,9 +134,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))
Shouldn’t this just use message-insert-formatted-citation-line?
Another approach you might take with this patch series is to look at
the message-cite-original function (which I just discovered as I was
plumbing around in message.el looking for the function to format the
citation line). I think that what one does to use this fn is to put
the original message text into the reply buffer (unquoted), set point
and mark to encompass it, then call the fn. It automatically handles
inserting the quotes, and has some customization options (stripping
signatures from replies, customizable quote character instead of “>”,
...).
The message-cite-original function also adds escape characters to the
cookies that message-mode uses to indicate sign/encrypt/attach
directives. I think notmuch exposes files on the user’s computer to
others, if a user can be tricked into replying to a message with an
attachment cookie and not stripping the cookie from the reply text. So
to mitigate this, whatever reply mechanism winds up being used should
call mml-quote-region on the reply text (as message-cite-original does).
I just sent a patch to the list to do this in the current version of
notmuch, which should show up in
id:"1326998589-37187-1-git-send-email-aaronecay@gmail.com" .
--
Aaron Ecay
next prev parent reply other threads:[~2012-01-19 18:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-19 17:46 [PATCH v3 0/5] Quoting HTML emails in reply Adam Wolfe Gordon
2012-01-19 17:46 ` [PATCH v3 1/5] test: Add broken test for the new JSON reply format Adam Wolfe Gordon
2012-01-19 17:46 ` [PATCH v3 2/5] reply: Add a " Adam Wolfe Gordon
2012-02-05 11:50 ` Mark Walters
2012-02-05 12:45 ` Mark Walters
2012-02-05 19:42 ` Adam Wolfe Gordon
2012-02-05 19:50 ` Dmitry Kurochkin
2012-02-06 3:44 ` Austin Clements
2012-02-06 6:27 ` Adam Wolfe Gordon
2012-01-19 17:46 ` [PATCH v3 3/5] man: Update notmuch-reply man page for JSON format Adam Wolfe Gordon
2012-01-19 17:46 ` [PATCH v3 4/5] emacs: Use the new JSON reply format Adam Wolfe Gordon
2012-02-05 12:41 ` Mark Walters
2012-01-19 17:46 ` [PATCH v3 5/5] emacs: Use message-citation-line-format in reply Adam Wolfe Gordon
2012-01-19 18:45 ` Aaron Ecay [this message]
2012-01-20 4:46 ` Adam Wolfe Gordon
2012-01-20 5:53 ` Aaron Ecay
2012-01-20 9:14 ` David Edmondson
2012-01-20 17:22 ` Adam Wolfe Gordon
2012-01-20 22:31 ` Tomi Ollila
2012-01-22 18:58 ` [PATCH v3 5/5] emacs: Use message-cite-original " Adam Wolfe Gordon
2012-02-09 0:21 ` [PATCH v4 0/4] Quoting HTML parts in reply (and other reply enhancements) Adam Wolfe Gordon
2012-02-09 0:21 ` [PATCH v4 1/4] test: Add broken test for the new JSON reply format Adam Wolfe Gordon
2012-02-09 0:21 ` [PATCH v4 2/4] reply: Add a " Adam Wolfe Gordon
2012-02-09 7:22 ` Dmitry Kurochkin
2012-02-10 4:27 ` Adam Wolfe Gordon
2012-02-10 8:39 ` Dmitry Kurochkin
2012-02-09 0:21 ` [PATCH v4 3/4] man: Update notmuch-reply man page for JSON format Adam Wolfe Gordon
2012-02-09 0:21 ` [PATCH v4 4/4] emacs: Use the new JSON reply format and message-cite-original 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=m2k44n4jlz.fsf@wal122.wireless-pennnet.upenn.edu \
--to=ecay@sas.upenn.edu \
--cc=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).