Gnus development mailing list
 help / color / mirror / Atom feed
* [Code] New date-format for summary-line
@ 2001-10-14 22:03 Frank Schmitt
  2001-10-15 10:55 ` Frank Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Schmitt @ 2001-10-14 22:03 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-10-14 22:03 [Code] New date-format for summary-line Frank Schmitt
@ 2001-10-15 10:55 ` Frank Schmitt
  2001-10-15 12:37   ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Schmitt @ 2001-10-15 10:55 UTC (permalink / raw)


Frank Schmitt <usereplyto@Frank-Schmitt.net> writes:

>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. 

Hmm, somehow there is still some kind of bug in it: when I use it (I've
put the setq's and the function in gnus-util.el and extended
gnus-summary-line-format-alist) the cursur is placed on the very end of
the summary line after I go to the next article.

I don't really understand why this happens, I do nothing with point. Any
suggestions?

-- 
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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-10-15 10:55 ` Frank Schmitt
@ 2001-10-15 12:37   ` Kai Großjohann
  2001-10-15 13:50     ` Frank Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2001-10-15 12:37 UTC (permalink / raw)
  Cc: ding

Frank Schmitt <usereplyto@Frank-Schmitt.net> writes:

> Hmm, somehow there is still some kind of bug in it: when I use it (I've
> put the setq's and the function in gnus-util.el and extended
> gnus-summary-line-format-alist) the cursur is placed on the very end of
> the summary line after I go to the next article.

By default, Gnus positions point at the first colon.  So if you put a
colon in gnus-summary-line-format, that might do the trick.

You can also use %C (I think, why is this not documented?) to specify
where point should be.

kai
-- 
Linux provides a nice `poweroff' command, but where is `poweron'?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-10-15 12:37   ` Kai Großjohann
@ 2001-10-15 13:50     ` Frank Schmitt
  2001-10-15 14:54       ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Schmitt @ 2001-10-15 13:50 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

>You can also use %C (I think, why is this not documented?) to specify
>where point should be.

It is documented but under Formatting variables->positioning point.
But it seems that's broken, at least over here it doesn't work but I
get a * instead. (Perhaps because it was the first element of the 
format-string?)

Nevertheless the hint with the colon did it and I now also know why I 
got the effect just when I used my function. (It displays the time as
mm:hh and I didn't have a colon in the format-string before.)

BTW: I would be really interested if you like gnus-user-date, or if you 
think it's either not necessary or badly implemented.

-- 
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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-10-15 13:50     ` Frank Schmitt
@ 2001-10-15 14:54       ` Kai Großjohann
  2001-12-30  0:33         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2001-10-15 14:54 UTC (permalink / raw)
  Cc: ding

Frank Schmitt <usereplyto@Frank-Schmitt.net> writes:

> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> 
>>You can also use %C (I think, why is this not documented?) to specify
>>where point should be.
> 
> It is documented but under Formatting variables->positioning point.

Oops.  I only looked with C-h v.  But I think if C-h v mentions _some_
percent escapes, then it should mention _all_ of them.

kai
-- 
Linux provides a nice `poweroff' command, but where is `poweron'?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-10-15 14:54       ` Kai Großjohann
@ 2001-12-30  0:33         ` Lars Magne Ingebrigtsen
  2002-01-02 11:23           ` Kai Großjohann
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2001-12-30  0:33 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

>>>You can also use %C (I think, why is this not documented?) to specify
>>>where point should be.
>> 
>> It is documented but under Formatting variables->positioning point.
>
> Oops.  I only looked with C-h v.  But I think if C-h v mentions _some_
> percent escapes, then it should mention _all_ of them.

None of the general specs -- %(, %C, etc -- are mentioned in the doc
strings of the variables.  Perhaps the doc strings should mention that
there are general specs not documented there...

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2001-12-30  0:33         ` Lars Magne Ingebrigtsen
@ 2002-01-02 11:23           ` Kai Großjohann
  2002-01-02 11:38             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2002-01-02 11:23 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> None of the general specs -- %(, %C, etc -- are mentioned in the doc
> strings of the variables.  Perhaps the doc strings should mention that
> there are general specs not documented there...

%( is explained in the doc string for gnus-summary-line-format, I
think.

But a pointer to the documentation about the general specs would be
useful.  Thanks a lot.

kai
-- 
Simplification good!  Oversimplification bad!  (Larry Wall)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2002-01-02 11:23           ` Kai Großjohann
@ 2002-01-02 11:38             ` Lars Magne Ingebrigtsen
  2002-01-03 12:44               ` Per Abrahamsen
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-01-02 11:38 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> But a pointer to the documentation about the general specs would be
> useful. 

I've now added a pointer to the manual to all (I think) line-format
spec variables.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Code] New date-format for summary-line
  2002-01-02 11:38             ` Lars Magne Ingebrigtsen
@ 2002-01-03 12:44               ` Per Abrahamsen
  0 siblings, 0 replies; 9+ messages in thread
From: Per Abrahamsen @ 2002-01-03 12:44 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> I've now added a pointer to the manual to all (I think) line-format
> spec variables.

defcustom has a :link option for this, which is used far too little.

I have added :link's to CVS. 




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-01-03 12:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-14 22:03 [Code] New date-format for summary-line Frank Schmitt
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

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).