Gnus development mailing list
 help / color / mirror / Atom feed
From: Frank Schmitt <usereplyto@Frank-Schmitt.net>
Subject: [Code] New date-format for summary-line
Date: Mon, 15 Oct 2001 00:03:48 +0200	[thread overview]
Message-ID: <pu7pc20r.fsf@hschmi22.userfqdn.rz-online.de> (raw)

Hi all.

The following function gives you the possibility to have different
date-formats in gnus-summary-line depending on if the article is of
today, this week, or older. 

I think the best place for this function would be gnus-util.el (at least
there are the other gnus-date functions. There should be a new item in
gnus-summary-line-format-alist like this:
(?q (gnus-user-date (mail-header-date gnus-tmp-header)) ?s)

It's my first lisp code, so don't hit me to hard if it's bullshit. At
least it does work over here.

;;there should be of course defvars for those three variables
(setq gnus-user-date-format-day "%k:%M")
(setq gnus-user-date-format-week "%a %k:%M")
(setq gnus-user-date-format-old "%d.%m.")

(defun gnus-user-date (messy-date)
  "Format the messy-date acording to gnus-user-date-format-*"
  (condition-case ()
      (progn
	(setq messy-date (safe-date-to-time messy-date))
	(setq now (current-time))
	(setq differenz (+ (lsh (- (car now) (car messy-date)) 16)
			   (- (car (cdr now)) (car (cdr messy-date)))))
	(setq now (decode-time now))
	(setq my-format gnus-user-date-format-old)
	(if (> (- (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)) differenz) -1)
	    ;;today
	    (setq my-format gnus-user-date-format-day)
	  (if (< differenz 604801)
	      ;;this week
	      (setq my-format gnus-user-date-format-week)))
	(format-time-string (eval my-format) messy-date))
    (error "  -   ")))

-- 
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the Land of Mordor where the Shadows lie.
19. Dezember 2001



             reply	other threads:[~2001-10-14 22:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-14 22:03 Frank Schmitt [this message]
2001-10-15 10:55 ` Frank Schmitt
2001-10-15 12:37   ` Kai Großjohann
2001-10-15 13:50     ` Frank Schmitt
2001-10-15 14:54       ` Kai Großjohann
2001-12-30  0:33         ` Lars Magne Ingebrigtsen
2002-01-02 11:23           ` Kai Großjohann
2002-01-02 11:38             ` Lars Magne Ingebrigtsen
2002-01-03 12:44               ` Per Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pu7pc20r.fsf@hschmi22.userfqdn.rz-online.de \
    --to=usereplyto@frank-schmitt.net \
    --cc=usenet@Frank-Schmitt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).