From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id jC5uMRGp9F4gZwAA0tVLHw (envelope-from ) for ; Thu, 25 Jun 2020 13:39:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cEO7LBGp9F5iKwAA1q6Kng (envelope-from ) for ; Thu, 25 Jun 2020 13:39:29 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AA39A9403C4 for ; Thu, 25 Jun 2020 13:39:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 41A796DE0B36; Thu, 25 Jun 2020 06:39:23 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HLnIVLHHUJrC; Thu, 25 Jun 2020 06:39:22 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 1DB016DE0AB2; Thu, 25 Jun 2020 06:39:22 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 7B97A6DE0AB2 for ; Thu, 25 Jun 2020 06:39:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8VHnySCJFGm4 for ; Thu, 25 Jun 2020 06:39:20 -0700 (PDT) X-Greylist: delayed 516 seconds by postgrey-1.36 at arlo; Thu, 25 Jun 2020 06:39:20 PDT Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by arlo.cworth.org (Postfix) with ESMTPS id 0F5556DE0A81 for ; Thu, 25 Jun 2020 06:39:19 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 49t19T60RyzKmhV; Thu, 25 Jun 2020 15:30:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id A6ZT69VfxEbz; Thu, 25 Jun 2020 15:30:33 +0200 (CEST) From: "Kevin J. Foley" To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Add notmuch-show-local-dates option Date: Thu, 25 Jun 2020 09:30:16 -0400 Message-Id: <20200625133016.29701-1-kevin@kevinjfoley.me> MIME-Version: 1.0 X-MBO-SPAM-Probability: 0 X-Rspamd-Score: -7.56 / 15.00 / 15.00 X-Rspamd-Queue-Id: 2C4CA175C X-Rspamd-UID: c81dbb X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 1.49 X-TUID: odBu0qplqeoD Allows users to specify they'd like dates to be displayed in local time --- emacs/notmuch-show.el | 12 +++++++++ test/T310-emacs.sh | 9 +++++++ .../notmuch-show-message-with-local-dates | 25 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 test/emacs.expected-output/notmuch-show-message-with-local-dates diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c9170466..cc87735d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -84,6 +84,11 @@ (defcustom notmuch-show-relative-dates t :type 'boolean :group 'notmuch-show) +(defcustom notmuch-show-local-dates nil + "Display local dates in the message header." + :type 'boolean + :group 'notmuch-show) + (defvar notmuch-show-markup-headers-hook '(notmuch-show-colour-headers) "A list of functions called to decorate the headers listed in `notmuch-message-headers'.") @@ -1067,6 +1072,13 @@ (defun notmuch-show-insert-msg (msg depth) (setq message-start (point-marker)) + (when notmuch-show-local-dates + (plist-put headers :Date + (format-time-string + "%a, %d %b %Y %H:%M:%S %z" + (apply #'encode-time + (parse-time-string (plist-get headers :Date)))))) + (notmuch-show-insert-headerline headers (or (if notmuch-show-relative-dates (plist-get msg :date_relative) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 5f74305d..5b1b4972 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -824,6 +824,15 @@ test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.g (test-visible-output)' test_expect_equal_file $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed OUTPUT +test_begin_subtest "notmuch-show: show local dates" +test_emacs \ + '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date")) + (notmuch-message-headers-visible t) + (notmuch-show-local-dates t)) + (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com") + (test-visible-output))' +test_expect_equal_file $EXPECTED/notmuch-show-message-with-local-dates OUTPUT + test_begin_subtest "Stashing in notmuch-show" add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \ '[from]="Some One "' \ diff --git a/test/emacs.expected-output/notmuch-show-message-with-local-dates b/test/emacs.expected-output/notmuch-show-message-with-local-dates new file mode 100644 index 00000000..4669e823 --- /dev/null +++ b/test/emacs.expected-output/notmuch-show-message-with-local-dates @@ -0,0 +1,25 @@ +Jan Janak (2009-11-17) (inbox) +Subject: [notmuch] What a great idea! + Jan Janak (2009-11-17) (inbox) + Subject: [notmuch] What a great idea! + To: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 22:38:47 +0000 + + On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak wrote: + > Hello, + > + > First of all, notmuch is a wonderful idea, both the cmdline tool and + [ 2 more citation lines. Click/Enter to show. ] + > + > Have you considered sending an announcement to the org-mode mailing list? + > http://org-mode.org + + Sorry, wrong URL, the correct one is: http://orgmode.org + + > Various ways of searching/referencing emails from emacs were discussed + > there several times and none of them were as elegant as notmuch (not + > even close). Maybe notmuch would attract some of the developers + > there.. + + -- Jan + Carl Worth (2009-11-18) (inbox unread) -- 2.19.0