[PATCH v2 5/4] emacs: Add customization for the first line of quotes.
Adam Wolfe Gordon
awg+notmuch at xvx.ca
Mon Jan 16 17:18:59 PST 2012
Add a customization option, notmuch-mua-reply-quoth, which controls
the first line of the reply body (typically, "On %date%, %from% wrote:").
This allows users who like other styles or correspond in other languages
to set an appropriate line using any of the quoted message's headers.
---
Due to some subsequent discussions in the thread about my original patch series,
I decided I may as well implement this sooner rather than later.
emacs/notmuch-mua.el | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index b03c62c..c7fd9f8 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -91,6 +91,14 @@ list."
(fill-region (point-min) (point-max))
(buffer-substring (point-min) (point-max)))))
+(defcustom notmuch-mua-reply-quoth "On %date%, %from% wrote:"
+ "The first line of a reply body, typically 'On %date%, %from% wrote:'.
+
+Any header fields from the message being replied to can be inserted by
+enclosing them in percents."
+ :group 'notmuch
+ :type 'string)
+
(defun notmuch-mua-reply (query-string &optional sender reply-all)
(let ((args '("reply" "--format=json"))
reply
@@ -132,10 +140,10 @@ 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 (replace-regexp-in-string "%.+?%"
+ (lambda (hdr) (cdr (assq (intern (substring hdr 1 (- (length hdr) 1))) original-headers)))
+ notmuch-mua-reply-quoth)))
+ (insert quoth "\n"))
(if (null plain-parts)
(mapc (lambda (part) (notmuch-mua-insert-part-quoted (notmuch-mua-parse-html-part part))) html-parts)
--
1.7.5.4
More information about the notmuch
mailing list