Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 66201418C24 for ; Tue, 17 Jan 2012 14:53:56 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HFJd5NkMorxx for ; Tue, 17 Jan 2012 14:53:55 -0800 (PST) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by olra.theworths.org (Postfix) with ESMTP id C7B4F41ED9E for ; Tue, 17 Jan 2012 14:53:54 -0800 (PST) Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd5ml1no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd6mo1no-svcs.prod.shaw.ca with ESMTP; 17 Jan 2012 15:53:54 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=bD0CuDYpMgGTku+nVSbZuKP/9fNjspX1F8zuwcoBWhM= c=1 sm=1 a=6y9XPzrDipoA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17 a=7343-z1_AAAA:8 a=YxpH_PJTSDrBUMo_-hgA:9 a=QYmB6SfJbQnURuRESEUA:7 a=0c-eHkXYtrgA:10 a=qbOB_sNrcAXsvv2H:21 a=Na4kHhFGYN_6axhN:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56]) by pd5ml1no-dmz.prod.shaw.ca with ESMTP; 17 Jan 2012 15:53:54 -0700 Received: by lagos.xvx.ca (Postfix, from userid 1000) id 8F9A58004C31; Tue, 17 Jan 2012 15:53:53 -0700 (MST) From: Adam Wolfe Gordon 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 Message-Id: <1326840818-6821-2-git-send-email-awg+notmuch@xvx.ca> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1326840818-6821-1-git-send-email-awg+notmuch@xvx.ca> References: <1326840818-6821-1-git-send-email-awg+notmuch@xvx.ca> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2012 22:53:56 -0000 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: Fcc: $(pwd)/mail/sent --text follows this line-- -On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite 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