mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-06 20:49:33 +00:00
Enable showing local time and lapsed time in Gnus
* lisp/gnus/gnus-art.el (article-make-date-combine-with-lapsed) factor code out into new function, used for providing both combined-lapsed and combined-local-lapsed.
This commit is contained in:
parent
d5c1e1211a
commit
2019a6d8a8
@ -12040,6 +12040,10 @@ The time elapsed since the message was posted.
|
||||
@item combined-lapsed
|
||||
Both the original date header and a (shortened) elapsed time.
|
||||
|
||||
@item combined-local-lapsed
|
||||
Both the time in the user's local time zone a (shortened) elapsed
|
||||
time.
|
||||
|
||||
@item original
|
||||
The original date header.
|
||||
|
||||
|
4
etc/NEWS
4
etc/NEWS
@ -923,6 +923,10 @@ Of course it will still find it if you have it in '~/.ecompleterc'.
|
||||
|
||||
** Gnus
|
||||
|
||||
*** There's a new value for `gnus-article-date-headers',
|
||||
`combined-local-lapsed', which will show both the time (in the local
|
||||
timezone) and the lapsed time.
|
||||
|
||||
---
|
||||
*** Gnus now maps imaps to 993 only on old MS-Windows versions.
|
||||
The nnimap backend used to do this unconditionally to work around
|
||||
|
@ -999,6 +999,7 @@ on parts -- for instance, adding Vcard info to a database."
|
||||
Valid formats are `ut' (Universal Time), `local' (local time
|
||||
zone), `english' (readable English), `lapsed' (elapsed time),
|
||||
`combined-lapsed' (both the original date and the elapsed time),
|
||||
`combined-local-lapsed' (both the local time and the elapsed time),
|
||||
`original' (the original date header), `iso8601' (ISO8601
|
||||
format), and `user-defined' (a user-defined format defined by the
|
||||
`gnus-article-time-format' variable).
|
||||
@ -1014,6 +1015,7 @@ Some of these headers are updated automatically. See
|
||||
(const :tag "Readable English" english)
|
||||
(const :tag "Elapsed time" lapsed)
|
||||
(const :tag "Original and elapsed time" combined-lapsed)
|
||||
(const :tag "Local and elapsed time" combined-local-lapsed)
|
||||
(const :tag "Original date header" original)
|
||||
(const :tag "ISO8601 format" iso8601)
|
||||
(const :tag "User-defined" user-defined)))
|
||||
@ -3528,10 +3530,28 @@ possible values."
|
||||
(put-text-property (match-beginning 1) (match-end 1)
|
||||
'face eface)))))))
|
||||
|
||||
(defun article-make-date-combine-with-lapsed (date time type)
|
||||
"Return type of date with lapsed time added."
|
||||
(let ((date-string (article-make-date-line date type))
|
||||
(segments 3)
|
||||
lapsed-string)
|
||||
(while (and
|
||||
time
|
||||
(setq lapsed-string
|
||||
(concat " (" (article-lapsed-string time segments) ")"))
|
||||
(> (+ (length date-string)
|
||||
(length lapsed-string))
|
||||
(+ fill-column 6))
|
||||
(> segments 0))
|
||||
(setq segments (1- segments)))
|
||||
(if (> segments 0)
|
||||
(concat date-string lapsed-string)
|
||||
date-string)))
|
||||
|
||||
(defun article-make-date-line (date type)
|
||||
"Return a DATE line of TYPE."
|
||||
(unless (memq type '(local ut original user-defined iso8601 lapsed english
|
||||
combined-lapsed))
|
||||
combined-lapsed combined-local-lapsed))
|
||||
(error "Unknown conversion type: %s" type))
|
||||
(condition-case ()
|
||||
(let ((time (ignore-errors (date-to-time date))))
|
||||
@ -3569,21 +3589,10 @@ possible values."
|
||||
(concat "Date: " (article-lapsed-string time)))
|
||||
;; A combined date/lapsed format.
|
||||
((eq type 'combined-lapsed)
|
||||
(let ((date-string (article-make-date-line date 'original))
|
||||
(segments 3)
|
||||
lapsed-string)
|
||||
(while (and
|
||||
time
|
||||
(setq lapsed-string
|
||||
(concat " (" (article-lapsed-string time segments) ")"))
|
||||
(> (+ (length date-string)
|
||||
(length lapsed-string))
|
||||
(+ fill-column 6))
|
||||
(> segments 0))
|
||||
(setq segments (1- segments)))
|
||||
(if (> segments 0)
|
||||
(concat date-string lapsed-string)
|
||||
date-string)))
|
||||
(article-make-date-combine-with-lapsed date time 'original))
|
||||
;; A combined local/lapsed format.
|
||||
((eq type 'combined-local-lapsed)
|
||||
(article-make-date-combine-with-lapsed date time 'local))
|
||||
;; Display the date in proper English
|
||||
((eq type 'english)
|
||||
(let ((dtime (decode-time time)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user