Re: [PATCH] emacs: Add notmuch-show-local-dates option
On Fri 2020-07-03 19:58:23 -0300, David Bremner wrote: > The bikeshed must be blue! Uh, I mean what about narrowish screens (80 > columns or so) and or deeply indented threads? You mean what should happen to messages with headers that are much longer, like: To: David Bremner , Kevin Foley , notmuch@notmuchmail.org ? 😛 If someone wants to propose an alternate compact representation that includes both the local time and the sender's TZ offset from where the reader is, but is shorter than what i'd proposed, i'm all ears… I originally tried the more compact: Date: Sat, 04 Jul 2020 09:25:26 -0400 (Sender's TZ +0200) But that isn't quite as useful as knowing what time the sender thought it was when they hit "send" (i don't want to have to do the math in my head). I also tried just showing the time (not the date) but then that gets confusing around the international date line. Time is hard, who knew‽ --dkg signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: Add notmuch-show-local-dates option
On Fri, Jul 03 2020, David Bremner wrote: > Daniel Kahn Gillmor writes: > >> But if the sender is in TZ=Europe/Berlin, i would see: >> >> Date: Fri, 03 Jul 2020 13:22:36 -0400 [Fri, 03 Jul 2020 19:22:36 +0200] >> >> (Note that RFC 5322 Date format shows the hour offset, but not the >> actual TZ -- i can't tell from -0400 whether someone is in >> TZ=America/New_York or TZ=America/Manaus) >> >> Is there anyone who would complain about this just being the default >> behavior -- with no additional settings to change? > > The bikeshed must be blue! Uh, I mean what about narrowish screens (80 > columns or so) and or deeply indented threads? After very casual read-thru we have had similar discussion in thread starting id:1427132722-20346-1-git-send-email-tomi.oll...@iki.fi https://nmbug.notmuchmail.org/nmweb/search/id%3A1427132722-20346-1-git-send-email-tomi.ollila%40iki.fi I've been patching my notmuch-emacs interface with that ever since, using https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch The Date header from David's email looked to me as Date: Fri, 03 Jul 2020 19:58:23 -0300 (Sat, 04 Jul 2020 01:58:23 +0300) (and fits fine in 80-column terminal window ;D -- 72 chars used -- when indent or replies with > goes too deep, everything wraps (or gets cut)...) Anyway, there are good comments in that thread -- and every now and then I've tried to figure out a bit different way to "solve" this -- but as my workaround work I've usually stopped short on that. For me the interests are to know what time the user sent the email (their timezone) and how that relates the time the other emails I've received (my timezone) -- not too much the (exact) location sender is... > > d Tomi ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: Add notmuch-show-local-dates option
Daniel Kahn Gillmor writes: > But if the sender is in TZ=Europe/Berlin, i would see: > > Date: Fri, 03 Jul 2020 13:22:36 -0400 [Fri, 03 Jul 2020 19:22:36 +0200] > > (Note that RFC 5322 Date format shows the hour offset, but not the > actual TZ -- i can't tell from -0400 whether someone is in > TZ=America/New_York or TZ=America/Manaus) > > Is there anyone who would complain about this just being the default > behavior -- with no additional settings to change? The bikeshed must be blue! Uh, I mean what about narrowish screens (80 columns or so) and or deeply indented threads? d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: Add notmuch-show-local-dates option
On Thu 2020-07-02 18:02:34 -0400, Kevin Foley wrote: > Daniel Kahn Gillmor writes: >> and it could take three values: >> >> - nil (default), shows the Date: header as received >> - t, shows the timestamp from the Date: header in local time, >>with the as-received header in parens afterward (see below) >> - "only", shows only the timestamp in localtime >> > > I feel like "only" makes more sense as the option to be used for t, and > having "both" as another option. I'm fine either way. >> so if your system is TZ=UTC, and notmuch-show-date-header-localtime is >> set to t, and you're looking at a message sent from TZ=America/New_York, >> you might see: >> >> Date: Thu, 02 Jul 2020 19:34:53 + (Thu, 02 Jul 2020 15:34:53 -0400) > > Actually, seeing it written out here makes me realize some people could > potentially prefer: > > Date: {sent-tz-datetime} ({system-tz-datetime}) > > or some other kind of formatting. > > Would it make sense to allow a function instead of "both", which would > be passed the time and let the user return it formatted how they would > like? Or is that over-complicating things? For a toolkit, i like the idea of a function. For an end-user-facing MUA, i like opinionated decisions that do obviously the right thing, without requiring the user to fiddle with anything. We're struggling a bit here because notmuch-emacs is sort of in the middle of these two things -- sometimes the one, other times the other. Pushing on the "just do the right thing" front: What if there were no configuration variable at all, and it just always shows "both" ? Or, even cleverer, what if it only shows both if the current TZ differs from the sender's TZ? So if i'm in TZ=America/New_York, and the sender is in TZ=America/New_York, i would just see the normal header: Date: Fri, 03 Jul 2020 13:22:36 -0400 But if the sender is in TZ=Europe/Berlin, i would see: Date: Fri, 03 Jul 2020 13:22:36 -0400 [Fri, 03 Jul 2020 19:22:36 +0200] (Note that RFC 5322 Date format shows the hour offset, but not the actual TZ -- i can't tell from -0400 whether someone is in TZ=America/New_York or TZ=America/Manaus) Is there anyone who would complain about this just being the default behavior -- with no additional settings to change? --dkg signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: Add notmuch-show-local-dates option
Daniel Kahn Gillmor writes: > But, setting this to t hides the sender's TZ from the viewer -- and i > often find it useful to learn the sender's TZ from the Date: header. > > What would be really useful for me is to see the Date header represented > both ways: in my local time *and* the Date header that the sender sent. > But a boolean setting doesn't give me much room to express that > preference. Good point, this is something I hadn't considered but I agree would be useful to allow. > This comment says "time", but the emacs config variable name says > "dates". This confusion is worse because the Date: header actually > contains a timestamp, not a date ☹ > > Perhaps we should rename the variable notmuch-show-date-header-localtime, I struggled with a name for the reasons you listed =), I think your proposed name is much clearer and will use that. > and it could take three values: > > - nil (default), shows the Date: header as received > - t, shows the timestamp from the Date: header in local time, >with the as-received header in parens afterward (see below) > - "only", shows only the timestamp in localtime > I feel like "only" makes more sense as the option to be used for t, and having "both" as another option. > so if your system is TZ=UTC, and notmuch-show-date-header-localtime is > set to t, and you're looking at a message sent from TZ=America/New_York, > you might see: > > Date: Thu, 02 Jul 2020 19:34:53 + (Thu, 02 Jul 2020 15:34:53 -0400) Actually, seeing it written out here makes me realize some people could potentially prefer: Date: {sent-tz-datetime} ({system-tz-datetime}) or some other kind of formatting. Would it make sense to allow a function instead of "both", which would be passed the time and let the user return it formatted how they would like? Or is that over-complicating things? Kevin ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: Add notmuch-show-local-dates option
This proposed notmuch-show-local-dates feature is a nice one. It renders the Date header in a format that is likely to be more useful to the viewer. I certainly find this more useful than having to do the TZ conversions in my head. But, setting this to t hides the sender's TZ from the viewer -- and i often find it useful to learn the sender's TZ from the Date: header. What would be really useful for me is to see the Date header represented both ways: in my local time *and* the Date header that the sender sent. But a boolean setting doesn't give me much room to express that preference. On Thu 2020-06-25 09:30:16 -0400, Kevin J. Foley wrote: > Allows users to specify they'd like dates to be displayed in local time This comment says "time", but the emacs config variable name says "dates". This confusion is worse because the Date: header actually contains a timestamp, not a date ☹ Perhaps we should rename the variable notmuch-show-date-header-localtime, and it could take three values: - nil (default), shows the Date: header as received - t, shows the timestamp from the Date: header in local time, with the as-received header in parens afterward (see below) - "only", shows only the timestamp in localtime so if your system is TZ=UTC, and notmuch-show-date-header-localtime is set to t, and you're looking at a message sent from TZ=America/New_York, you might see: Date: Thu, 02 Jul 2020 19:34:53 + (Thu, 02 Jul 2020 15:34:53 -0400) Would that be too much configurability? --dkg signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] emacs: Add notmuch-show-local-dates option
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:f35dbb950911171438k5df6eb56k77b6c0944e2e7...@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 -"' \ '[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 ..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 + + + 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 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch