diff options
author | Gnus developers <ding@gnus.org> | 2011-02-03 23:43:22 +0000 |
---|---|---|
committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2011-02-03 23:43:22 +0000 |
commit | 0d1c2cc8c871005071a3929618616245623376db (patch) | |
tree | 81d703a044b37855ea9497664247882c66754657 /lisp/gnus/gnus-sum.el | |
parent | 5dc7a1d2c412fc485cca66a2be76f50bfa1f16d7 (diff) | |
download | emacs-0d1c2cc8c871005071a3929618616245623376db.tar.gz |
Merge changes made in Gnus trunk.
gnus-util.el: change default value of gnus-user-date-format-alist.
gnus-art.el (gnus-article-jump-to-part): Remove useless sit-for.
gnus-art.el: remove old FIXME.
gnus.el (gnus-summary-line-format): Add missing semi-colon for user-date in docstring.
message.el (message-setup-1): Always generate References first.
(message-mail): Return the return value of message-setup, not always t.
gnus-start.el (gnus-read-active-for-groups): This function is never called with a nil `infos', so clean that up.
(gnus-get-unread-articles): Request active files from primary/secondary methods that have no groups (yet).
(message-setup-1): Insert mail-header-separator with read-only and intangible properties set.
gnus-draft.el: Remove progn around gnus-draft-setup.
gnus-start.el (gnus-get-unread-articles): Fix the call to methods that have no groups.
nnimap.el (nnimap-request-accept-article): Give an error message if the APPEND wasn't successful.
Diffstat (limited to 'lisp/gnus/gnus-sum.el')
-rw-r--r-- | lisp/gnus/gnus-sum.el | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 3b003b74626..c40fcc7fe13 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1395,7 +1395,7 @@ the normal Gnus MIME machinery." (?u gnus-tmp-user-defined ?s) (?P (gnus-pick-line-number) ?d) (?B gnus-tmp-thread-tree-header-string ?s) - (user-date (gnus-user-date + (user-date (gnus-summary-user-date ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s)) "An alist of format specifications that can appear in summary lines. These are paired with what variables they correspond with, along with @@ -3852,6 +3852,56 @@ This function is intended to be used in ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024)))) (t (format "%dM" (/ c (* 1024.0 1024))))))) +(defcustom gnus-summary-user-date-format-alist + '(((gnus-seconds-today) . "Today, %H:%M") + ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M") + (604800 . "%A %H:%M") ; That's one week + ((gnus-seconds-month) . "%A %d") + ((gnus-seconds-year) . "%B %d") + (t . "%b %d %Y")) ; This one is used when no other + ; does match + "Specifies date format depending on age of article. +This is an alist of items (AGE . FORMAT). AGE can be a number (of +seconds) or a Lisp expression evaluating to a number. When the age of +the article is less than this number, then use `format-time-string' +with the corresponding FORMAT for displaying the date of the article. +If AGE is not a number or a Lisp expression evaluating to a +non-number, then the corresponding FORMAT is used as a default value. + +Note that the list is processed from the beginning, so it should be +sorted by ascending AGE. Also note that items following the first +non-number AGE will be ignored. + +You can use the functions `gnus-seconds-today', `gnus-seconds-month' +and `gnus-seconds-year' in the AGE spec. They return the number of +seconds passed since the start of today, of this month, of this year, +respectively." + :version "24.1" + :group 'gnus-summary-format + :type '(alist :key-type sexp :value-type string)) +(make-obsolete-variable 'gnus-user-date-format-alist + 'gnus-summary-user-date-format-alist "24.1") + +(defun gnus-summary-user-date (messy-date) + "Format the messy-date according to `gnus-summary-user-date-format-alist'. +Returns \" ? \" if there's bad input or if another error occurs. +Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"." + (condition-case () + (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date))) + (now (gnus-float-time)) + ;;If we don't find something suitable we'll use this one + (my-format "%b %d '%y")) + (let* ((difference (- now messy-date)) + (templist gnus-summary-user-date-format-alist) + (top (eval (caar templist)))) + (while (if (numberp top) (< top difference) (not top)) + (progn + (setq templist (cdr templist)) + (setq top (eval (caar templist))))) + (if (stringp (cdr (car templist))) + (setq my-format (cdr (car templist))))) + (format-time-string (eval my-format) (seconds-to-time messy-date))) + (error " ? "))) (defun gnus-summary-set-local-parameters (group) "Go through the local params of GROUP and set all variable specs in that list." |