--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C63256DE1BD9\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Apr 2015 01:02:22 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.648\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.648 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,\r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id v4x-foidR_dK for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Apr 2015 01:02:19 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 04AD06DE1BD5\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Apr 2015 01:02:17 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Yf1z0-0008Fd-7u; Mon, 06 Apr 2015 09:02:12 +0100\r
+Received: from 188.30.14.65.threembb.co.uk ([188.30.14.65] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Yf1yy-0004mR-NP; Mon, 06 Apr 2015 09:02:09 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
+Subject: Re: [DRAFT PATCH] emacs: show local date next to Date: in case\r
+ value differs\r
+In-Reply-To: <1427132722-20346-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1427132722-20346-1-git-send-email-tomi.ollila@iki.fi>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 06 Apr 2015 09:02:02 +0100\r
+Message-ID: <876199sn0l.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 188.30.14.65\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: fc86f14ff3bd18906a41bb88a710de30 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.0 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider\r
+ * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+Cc: tomi.ollila@iki.fi, Tomi Ollila <too@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 06 Apr 2015 08:02:22 -0000\r
+\r
+On Mon, 23 Mar 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> From: Tomi Ollila <too@iki.fi>\r
+>\r
+> When adding Date: header of a message to notmuch-show buffer, compare the\r
+> date string with local representation of it and if these differ, output\r
+> Date: {original-date-string} ({local-date-representation})\r
+>\r
+> This is useful e.g. when mail system provides Date: strings with\r
+> different timezone information than the sender is located at.\r
+\r
+I think this could be useful. I have to admit that until David pointed\r
+it out in his reply I hadn't noticed the date in the headerline and I do\r
+think the date header is a natural place to display this.\r
+\r
+Jani made a comment on irc that the display could be rather cluttered\r
+so I think it should be customizable. Ideally I would suggest having the\r
+options of none (ie display just the sender date as now), local full\r
+date (as your patch), and relative (to put the relative date in the\r
+date header).\r
+\r
+I have some small comments on the implementation: \r
+\r
+> ---\r
+> emacs/notmuch-show.el | 25 +++++++++++++++++++------\r
+> 1 file changed, 19 insertions(+), 6 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index f15f981..7e81859 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -460,15 +460,28 @@ (defun notmuch-show-insert-header (header header-value)\r
+> "Insert a single header."\r
+> (insert header ": " (notmuch-sanitize header-value) "\n"))\r
+> \r
+> -(defun notmuch-show-insert-headers (headers)\r
+> +(defun notmuch--make-date (timestamp)\r
+> + (if (> timestamp 2147483647)\r
+> + (message-make-date (seconds-to-time timestamp))\r
+> + (message-make-date (encode-time timestamp 0 0 1 1 1970 t))))\r
+> +\r
+> +(defun notmuch-show-insert-headers (headers &optional timestamp)\r
+\r
+I suggest passing msg as an optional argument instead of timestamp. I\r
+think it will be more flexible if people want to have other\r
+header modification functions in the future (for example we could add\r
+the senders name to the from line if we know it from other messages).\r
+\r
+> "Insert the headers of the current message."\r
+> - (let ((start (point)))\r
+> + (let ((start (point))\r
+> + date-local)\r
+> (mapc (lambda (header)\r
+> (let* ((header-symbol (intern (concat ":" header)))\r
+> (header-value (plist-get headers header-symbol)))\r
+\r
+> - (if (and header-value\r
+> - (not (string-equal "" header-value)))\r
+> - (notmuch-show-insert-header header header-value))))\r
+\r
+> + (when (and header-value\r
+> + (not (string-equal "" header-value)))\r
+> + (if (and timestamp\r
+> + (string-equal header "Date")\r
+> + (not (string-equal\r
+> + (setq date-local (notmuch--make-date timestamp))\r
+> + header-value)))\r
+> + (setq header-value\r
+> + (format "%s (%s)" header-value date-local)))\r
+\r
+I think I would extract this block as a date-header-wash function. Then\r
+the one special case doesn't interrupt the main function. Something like\r
+\r
+ (let ((washed-header-value (if (string-equal header "Date")\r
+ (notmuch-date-header-wash header msg)\r
+ header-value)))\r
+\r
+(This could go inside or outside the "when")\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+> + (notmuch-show-insert-header header header-value))))\r
+> notmuch-message-headers)\r
+> (save-excursion\r
+> (save-restriction\r
+> @@ -1012,7 +1025,7 @@ (defun notmuch-show-insert-msg (msg depth)\r
+> ;; Set `headers-start' to point after the 'Subject:' header to be\r
+> ;; compatible with the existing implementation. This just sets it\r
+> ;; to after the first header.\r
+> - (notmuch-show-insert-headers headers)\r
+> + (notmuch-show-insert-headers headers (plist-get msg :timestamp))\r
+> (save-excursion\r
+> (goto-char content-start)\r
+> ;; If the subject of this message is the same as that of the\r
+> -- \r
+> 1.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r