* timezone in notmuch
@ 2020-04-14 13:51 divan
2020-04-14 20:51 ` David Bremner
2020-04-15 20:17 ` Tomi Ollila
0 siblings, 2 replies; 7+ messages in thread
From: divan @ 2020-04-14 13:51 UTC (permalink / raw)
To: notmuch
Greetings :)
In notmuch-show-mode, some emails have a date like this: Date: Thu, 09
Apr 2020 14:34:42 +0000 while others like this Date: Sun, 12 Apr 2020
21:04:01 +0200
Is this something I can change in notmuch to always show the date/time
in my local timezone (SAST/+0200)?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-14 13:51 timezone in notmuch divan
@ 2020-04-14 20:51 ` David Bremner
2020-04-14 20:53 ` David Bremner
2020-04-15 20:17 ` Tomi Ollila
1 sibling, 1 reply; 7+ messages in thread
From: David Bremner @ 2020-04-14 20:51 UTC (permalink / raw)
To: divan, notmuch
divan@santanas.co.za writes:
> Greetings :)
>
> In notmuch-show-mode, some emails have a date like this: Date: Thu, 09
> Apr 2020 14:34:42 +0000 while others like this Date: Sun, 12 Apr 2020
> 21:04:01 +0200
>
> Is this something I can change in notmuch to always show the date/time
> in my local timezone (SAST/+0200)?
There's no user customizable variable for this. The code in this part of
notmuch show is fairly simple, so someone could probably figure out how
to pass (notmuch-show-get-timestamp) to the appropriate emacs function
to format the date in the local timezone.
d
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-14 20:51 ` David Bremner
@ 2020-04-14 20:53 ` David Bremner
2020-04-15 17:15 ` Divan Santana
0 siblings, 1 reply; 7+ messages in thread
From: David Bremner @ 2020-04-14 20:53 UTC (permalink / raw)
To: divan, notmuch
David Bremner <david@tethera.net> writes:
>
> There's no user customizable variable for this. The code in this part of
> notmuch show is fairly simple, so someone could probably figure out how
> to pass (notmuch-show-get-timestamp) to the appropriate emacs function
> to format the date in the local timezone.
I should mention that having "notmuch-show-relative-dates" on hides this
problem, since it doesn't use timezones at all. Perhaps you would prefer
that (or perhaps not).
d
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-14 20:53 ` David Bremner
@ 2020-04-15 17:15 ` Divan Santana
0 siblings, 0 replies; 7+ messages in thread
From: Divan Santana @ 2020-04-15 17:15 UTC (permalink / raw)
To: David Bremner, notmuch
>> There's no user customizable variable for this. The code in this part of
>> notmuch show is fairly simple, so someone could probably figure out how
>> to pass (notmuch-show-get-timestamp) to the appropriate emacs function
>> to format the date in the local timezone.
>
> I should mention that having "notmuch-show-relative-dates" on hides this
> problem, since it doesn't use timezones at all. Perhaps you would prefer
> that (or perhaps not).
Good to know thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-14 13:51 timezone in notmuch divan
2020-04-14 20:51 ` David Bremner
@ 2020-04-15 20:17 ` Tomi Ollila
2020-04-15 21:48 ` Brian May
2020-04-16 5:37 ` Teemu Likonen
1 sibling, 2 replies; 7+ messages in thread
From: Tomi Ollila @ 2020-04-15 20:17 UTC (permalink / raw)
To: divan, notmuch
On Tue, Apr 14 2020, divan@santanas.co.za wrote:
> Greetings :)
>
> In notmuch-show-mode, some emails have a date like this: Date: Thu, 09
> Apr 2020 14:34:42 +0000 while others like this Date: Sun, 12 Apr 2020
> 21:04:01 +0200
>
> Is this something I can change in notmuch to always show the date/time
> in my local timezone (SAST/+0200)?
I use this:
https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch
I've been thinking if some hook could be added to notmuch-emacs so
that such a custom date mangling can be done outside of the notmuch-emacs
source...
Tomi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-15 20:17 ` Tomi Ollila
@ 2020-04-15 21:48 ` Brian May
2020-04-16 5:37 ` Teemu Likonen
1 sibling, 0 replies; 7+ messages in thread
From: Brian May @ 2020-04-15 21:48 UTC (permalink / raw)
To: Tomi Ollila, divan, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
> I use this:
>
> https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch
>
> I've been thinking if some hook could be added to notmuch-emacs so
> that such a custom date mangling can be done outside of the notmuch-emacs
> source...
I would like to see something like this without having to patch notmuch.
As much as I like notmuch-show-relative-dates, occasionally, I just want
to be able to see the exact time an email was sent in my timezone.
--
Brian May <brian@linuxpenguins.xyz>
https://linuxpenguins.xyz/brian/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: timezone in notmuch
2020-04-15 20:17 ` Tomi Ollila
2020-04-15 21:48 ` Brian May
@ 2020-04-16 5:37 ` Teemu Likonen
1 sibling, 0 replies; 7+ messages in thread
From: Teemu Likonen @ 2020-04-16 5:37 UTC (permalink / raw)
To: Tomi Ollila, divan, notmuch
[-- Attachment #1.1: Type: text/plain, Size: 2682 bytes --]
Tomi Ollila [2020-04-15T23:17:32+03] wrote:
> I use this:
>
> https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch
>
> I've been thinking if some hook could be added to notmuch-emacs so
> that such a custom date mangling can be done outside of the
> notmuch-emacs source...
Formerly I used Emacs Gnus and its hook to change the date. For this
discussion I adapted the idea to Notmuch. The code below is based on
idea that after article display there is a hook which can do anything
user wants. I wanted ISO 8601 date.
;; Add a hook for changing article's date string.
(add-hook 'some-article-display-hook 'tl-notmuch-custom-article-date)
(defmacro notmuch-narrow-to-article-headers (&rest body)
;; Implement macro which uses NARROW function to narrow current buffer
;; to article's headers only.
`(progn ,@body))
(defun tl-notmuch-custom-article-date ()
(save-excursion
(save-match-data
(notmuch-narrow-to-article-headers
(goto-char (point-min))
(when (re-search-forward "^Date: \\(.+\\)$" nil t)
(let ((inhibit-read-only t))
(replace-match (tl-message-date-string-iso
(match-string-no-properties 1))
nil t nil 1)))))))
(defun tl-message-date-string-iso (string)
;; Parse message date STRING and return ISO 8601 time string.
(require 'parse-time)
(condition-case nil
(let* ((date-list (parse-time-string string))
(year (nth 5 date-list))
(month (nth 4 date-list))
(day (nth 3 date-list))
(hour (nth 2 date-list))
(min (nth 1 date-list))
(sec (nth 0 date-list))
(tz-total-sec (nth 8 date-list)))
(format "%04d-%02d-%02dT%02d:%02d:%02d%s"
year month day hour min sec
(if (not tz-total-sec)
""
(let* ((tz-sign (if (>= tz-total-sec 0) "+" "-"))
(tz-hour (truncate (abs tz-total-sec) 3600))
(tz-min (truncate (- (abs tz-total-sec)
(* tz-hour 3600))
60)))
(cond
((= tz-hour tz-min 0) "Z")
((= tz-min 0)
(format "%s%02d" tz-sign tz-hour))
(t
(format "%s%02d:%02d" tz-sign tz-hour tz-min)))))))
(error string)))
--
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-04-16 5:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14 13:51 timezone in notmuch divan
2020-04-14 20:51 ` David Bremner
2020-04-14 20:53 ` David Bremner
2020-04-15 17:15 ` Divan Santana
2020-04-15 20:17 ` Tomi Ollila
2020-04-15 21:48 ` Brian May
2020-04-16 5:37 ` Teemu Likonen
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).