unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Postscript print buffer with ISO date?
@ 2003-02-20  8:42 Svend Tollak Munkejord
  2003-02-20  9:11 ` François Fleuret
  2003-02-20  9:34 ` Eric Marsden
  0 siblings, 2 replies; 7+ messages in thread
From: Svend Tollak Munkejord @ 2003-02-20  8:42 UTC (permalink / raw)


Hi,

I use GNU Emacs 21.2. When I print a buffer using the "Postscript print
buffer" function, Emacs prints the date in the format mm/dd/yyyy
(e.g. 02/20/2003 today). I would like it to use the ISO format
yyyy-mm-dd. I searched the manual, but did not find out how to do this. Can
anyone help?

Regards,
-- 
Svend Tollak Munkejord 

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

* Re: Postscript print buffer with ISO date?
  2003-02-20  8:42 Postscript print buffer with ISO date? Svend Tollak Munkejord
@ 2003-02-20  9:11 ` François Fleuret
  2003-02-20  9:34 ` Eric Marsden
  1 sibling, 0 replies; 7+ messages in thread
From: François Fleuret @ 2003-02-20  9:11 UTC (permalink / raw)


Hi,

Svend Tollak Munkejord wrote on 20 Feb 2003 09:42:16 MET:

> I use GNU Emacs 21.2. When I print a buffer using the "Postscript
> print buffer" function, Emacs prints the date in the format
> mm/dd/yyyy (e.g. 02/20/2003 today). I would like it to use the ISO
> format yyyy-mm-dd.

See the variable `ps-right-header', it seems to do that.

Regards,

FF

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

* Re: Postscript print buffer with ISO date?
  2003-02-20  8:42 Postscript print buffer with ISO date? Svend Tollak Munkejord
  2003-02-20  9:11 ` François Fleuret
@ 2003-02-20  9:34 ` Eric Marsden
  2003-02-20  9:55   ` Svend Tollak Munkejord
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Marsden @ 2003-02-20  9:34 UTC (permalink / raw)


>>>>> "stm" == Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:

  stm> I use GNU Emacs 21.2. When I print a buffer using the
  stm> "Postscript print buffer" function, Emacs prints the date in
  stm> the format mm/dd/yyyy (e.g. 02/20/2003 today). I would like it
  stm> to use the ISO format yyyy-mm-dd. I searched the manual, but
  stm> did not find out how to do this. Can anyone help?

the stuff that is printed on the right side of the header is
determined by the variable ps-right-header. If you examine the
contents of this variable, you probably have an element like
ps-time-stamp-mon-dd-yyyy. Just change this element to something that
you prefer. 

   (require 'cl)
   (defun my-iso8601-date () (format-time-string "%Y-%d-%d"))
   (eval-after-load "ps-print"
     (setf (second ps-print-header) 'my-iso8601-date))

-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

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

* Re: Postscript print buffer with ISO date?
  2003-02-20  9:34 ` Eric Marsden
@ 2003-02-20  9:55   ` Svend Tollak Munkejord
  2003-02-20 10:20     ` Eric Marsden
  0 siblings, 1 reply; 7+ messages in thread
From: Svend Tollak Munkejord @ 2003-02-20  9:55 UTC (permalink / raw)


Today, Eric Marsden <emarsden@laas.fr> wrote:

>>>>>> "stm" == Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:
> 
>   stm> I use GNU Emacs 21.2. When I print a buffer using the
>   stm> "Postscript print buffer" function, Emacs prints the date in
>   stm> the format mm/dd/yyyy (e.g. 02/20/2003 today). I would like it
>   stm> to use the ISO format yyyy-mm-dd. I searched the manual, but
>   stm> did not find out how to do this. Can anyone help?
> 
> the stuff that is printed on the right side of the header is
> determined by the variable ps-right-header. If you examine the
> contents of this variable, you probably have an element like
> ps-time-stamp-mon-dd-yyyy. Just change this element to something that
> you prefer. 

Thanks to you and to François for pointing me to the right place.

>    (require 'cl)
>    (defun my-iso8601-date () (format-time-string "%Y-%d-%d"))
>    (eval-after-load "ps-print"
>      (setf (second ps-print-header) 'my-iso8601-date))

I came up with this:

(defun ps-time-stamp-iso ()
  "Return date as \"2003-02-20\"."
  (format-time-string "%Y-%m-%d"))
(setq ps-right-header '("/pagenumberstring load" ps-time-stamp-iso ps-time-stamp-hh:mm:ss))

Is your solution preferable?

Regards,
-- 
Svend Tollak Munkejord 

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

* Re: Postscript print buffer with ISO date?
  2003-02-20  9:55   ` Svend Tollak Munkejord
@ 2003-02-20 10:20     ` Eric Marsden
  2003-02-20 20:24       ` Kevin Rodgers
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Marsden @ 2003-02-20 10:20 UTC (permalink / raw)


>>>>> "stm" == Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:

  ecm> (require 'cl)
  ecm> (defun my-iso8601-date () (format-time-string "%Y-%d-%d"))
  ecm> (eval-after-load "ps-print"
  ecm>    (setf (second ps-print-header) 'my-iso8601-date))

  stm> (defun ps-time-stamp-iso ()
  stm> "Return date as \"2003-02-20\"."
  stm> (format-time-string "%Y-%m-%d"))
  stm> (setq ps-right-header '("/pagenumberstring load" ps-time-stamp-iso ps-time-stamp-hh:mm:ss))
  stm> 
  stm> Is your solution preferable?

in many cases, you have to load a module before being able to
customize it; if you load many modules from your init file, Emacs will
be slow to start up. The special form 'eval-after-load' allows you to
customize a module after it is autoloaded.

An other point is that neither solution will work well if the default
contents of the ps-right-header variable change in the future.
  
-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

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

* Re: Postscript print buffer with ISO date?
  2003-02-20 10:20     ` Eric Marsden
@ 2003-02-20 20:24       ` Kevin Rodgers
  2003-02-21  8:25         ` Eric Marsden
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2003-02-20 20:24 UTC (permalink / raw)


Eric Marsden wrote:

>>>>>>"stm" == Svend Tollak Munkejord <stm@bacchus.pvv.org> writes:
>>>>>>
> 
>   ecm> (require 'cl)
>   ecm> (defun my-iso8601-date () (format-time-string "%Y-%d-%d"))
>   ecm> (eval-after-load "ps-print"
>   ecm>    (setf (second ps-print-header) 'my-iso8601-date))
> 
>   stm> (defun ps-time-stamp-iso ()
>   stm> "Return date as \"2003-02-20\"."
>   stm> (format-time-string "%Y-%m-%d"))
>   stm> (setq ps-right-header '("/pagenumberstring load" ps-time-stamp-iso ps-time-stamp-hh:mm:ss))
>   stm> 
>   stm> Is your solution preferable?
...
> An other point is that neither solution will work well if the default
> contents of the ps-right-header variable change in the future.

How about

(setcar (memq 'time-stamp-mon-dd-yyyy ps-right-header) 'ps-time-stamp-iso)

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: Postscript print buffer with ISO date?
  2003-02-20 20:24       ` Kevin Rodgers
@ 2003-02-21  8:25         ` Eric Marsden
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Marsden @ 2003-02-21  8:25 UTC (permalink / raw)


>>>>> "kr" == Kevin Rodgers <kevin.rodgers@ihs.com> writes:

  ecm> An other point is that neither solution will work well if the default
  ecm> contents of the ps-right-header variable change in the future.

  kr> How about
  kr> 
  kr> (setcar (memq 'time-stamp-mon-dd-yyyy ps-right-header) 'ps-time-stamp-iso)

that's better, but it still won't work correctly if the default
for the date element changes to something like 'time-stamp-per-locale.
  
-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

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

end of thread, other threads:[~2003-02-21  8:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-20  8:42 Postscript print buffer with ISO date? Svend Tollak Munkejord
2003-02-20  9:11 ` François Fleuret
2003-02-20  9:34 ` Eric Marsden
2003-02-20  9:55   ` Svend Tollak Munkejord
2003-02-20 10:20     ` Eric Marsden
2003-02-20 20:24       ` Kevin Rodgers
2003-02-21  8:25         ` Eric Marsden

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