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 40FBE429E3B for ; Mon, 16 Jan 2012 17:19:08 -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 OFq-mhMlKrLt for ; Mon, 16 Jan 2012 17:19:07 -0800 (PST) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by olra.theworths.org (Postfix) with ESMTP id AED2A429E35 for ; Mon, 16 Jan 2012 17:19:07 -0800 (PST) Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd6ml3no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd6mo1no-svcs.prod.shaw.ca with ESMTP; 16 Jan 2012 18:19:05 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=gFGh1ScE7ROJHT2jhivHYaSHya8441O0LZB7wkhlVyo= c=1 sm=1 a=uWECbD2RVlEA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17 a=Y2B7Pfn4WVGIM53Y2qsA:9 a=2_Xq26Wg9FFebKwHAtUA:7 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56]) by pd6ml3no-dmz.prod.shaw.ca with ESMTP; 16 Jan 2012 18:19:05 -0700 Received: by lagos.xvx.ca (Postfix, from userid 1000) id A8E828004208; Mon, 16 Jan 2012 18:19:05 -0700 (MST) From: Adam Wolfe Gordon To: notmuch@notmuchmail.org Subject: [PATCH v2 5/4] emacs: Add customization for the first line of quotes. Date: Mon, 16 Jan 2012 18:18:59 -0700 Message-Id: <1326763139-31146-1-git-send-email-awg+notmuch@xvx.ca> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1326737603-21166-1-git-send-email-awg+notmuch@xvx.ca> References: <1326737603-21166-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 01:19:08 -0000 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