unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* automatic time-stamp
@ 2005-05-03 23:49 Jeffrey L. Greer
  2005-05-04  6:46 ` Peter Tury
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jeffrey L. Greer @ 2005-05-03 23:49 UTC (permalink / raw)


I am trying to configure automatic time-stamp for emacs 21 in a Debian
Sarge system. I have the following .emacs file in my home directory. I
have read and re-read what seems to be the relevant pages in the hard
copy of Gnu Emacs Manual. Time stamp will only work manually.

Suggestions please? Thank you, Jeff Greer

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(add-hook (quote write-file-hooks) t)
 '(case-fold-search t)
 '(column-number-mode t)
 '(current-language-environment "English")
 '(global-font-lock-mode t nil (font-lock))
 '(time-stamp-active t))

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

* Re: automatic time-stamp
  2005-05-03 23:49 automatic time-stamp Jeffrey L. Greer
@ 2005-05-04  6:46 ` Peter Tury
  2005-05-04  6:50 ` Holger Sparr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Tury @ 2005-05-04  6:46 UTC (permalink / raw)


"Jeffrey L. Greer" <jlgreer1@excite.com> wrote in message
news:w6Ude.26842$r81.5612@trnddc02...
> I am trying to configure automatic time-stamp for emacs 21 in a Debian
> Sarge system. I have the following .emacs file in my home directory. I
> have read and re-read what seems to be the relevant pages in the hard
> copy of Gnu Emacs Manual. Time stamp will only work manually.
>
> Suggestions please? Thank you, Jeff Greer
>
> (custom-set-variables
>   ;; custom-set-variables was added by Custom -- don't edit or cut/paste
it!
>   ;; Your init file should contain only one such instance.
>  '(add-hook (quote write-file-hooks) t)
>  '(case-fold-search t)
>  '(column-number-mode t)
>  '(current-language-environment "English")
>  '(global-font-lock-mode t nil (font-lock))
>  '(time-stamp-active t))

Hi,

I don't know whether this will help you, but the on-line help (C-h a
time-stamp) writes this:

time-stamp is an interactive autoloaded Lisp function in `time-stamp'.
[Arg list not available until function definition is loaded.]

Update the time stamp string(s) in the buffer.
A template in a file can be automatically updated with a new time stamp
every time you save the file.  Add this line to your .emacs file:
    (add-hook 'write-file-hooks 'time-stamp)
Normally the template must appear in the first 8 lines of a file and
look like one of the following:
      Time-stamp: <>
      Time-stamp: " "
The time stamp is written between the brackets or quotes:
      Time-stamp: <1998-02-18 10:20:51 gildea>
The time stamp is updated only if the variable `time-stamp-active' is
non-nil.
The format of the time stamp is set by the variable `time-stamp-format'.
The variables `time-stamp-line-limit', `time-stamp-start', `time-stamp-end',
`time-stamp-count', and `time-stamp-inserts-lines' control finding the
template.

So I think (add-hook 'write-file-hooks 'time-stamp) should be added to your
.emacs (+ the appropriate templates to your files?).

Br,
P

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

* Re: automatic time-stamp
  2005-05-03 23:49 automatic time-stamp Jeffrey L. Greer
  2005-05-04  6:46 ` Peter Tury
@ 2005-05-04  6:50 ` Holger Sparr
  2005-05-04  8:19 ` Tim X
  2005-05-04 20:58 ` Peter Dyballa
  3 siblings, 0 replies; 6+ messages in thread
From: Holger Sparr @ 2005-05-04  6:50 UTC (permalink / raw)


On Tue, 03 May 2005, Jeffrey L. Greer wrote:
> I am trying to configure automatic time-stamp for emacs 21 in a Debian
> Sarge system. I have the following .emacs file in my home directory. I
> have read and re-read what seems to be the relevant pages in the hard
> copy of Gnu Emacs Manual. Time stamp will only work manually.
> 

,----[ C-h f time-stamp RET ]
| time-stamp is an interactive compiled Lisp function in `time-stamp'.
| (time-stamp)
| 
| Update the time stamp string(s) in the buffer.
| A template in a file can be automatically updated with a new time stamp
| every time you save the file.  Add this line to your .emacs file:
|     (add-hook 'write-file-hooks 'time-stamp)
| Normally the template must appear in the first 8 lines of a file and
| look like one of the following:
|       Time-stamp: <>
|       Time-stamp: " "
| The time stamp is written between the brackets or quotes:
|       Time-stamp: <1998-02-18 10:20:51 gildea>
| The time stamp is updated only if the variable `time-stamp-active' is
| non-nil.  The format of the time stamp is set by the variable
| `time-stamp-format'.  The variables `time-stamp-line-limit',
| `time-stamp-start', `time-stamp-end', `time-stamp-count', and
| `time-stamp-inserts-lines' control finding the template.
`----

Put a line containing: 

       "Time-stamp: <>"

in one of the first 8 lines of the file you want to time stamp.

With 

(add-hook 'write-file-hooks 'time-stamp) 

in your .emacs the above string gets updated when the file is being
saved.


-- 

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

* Re: automatic time-stamp
  2005-05-03 23:49 automatic time-stamp Jeffrey L. Greer
  2005-05-04  6:46 ` Peter Tury
  2005-05-04  6:50 ` Holger Sparr
@ 2005-05-04  8:19 ` Tim X
  2005-05-04 10:48   ` Jeffrey L. Greer
  2005-05-04 20:58 ` Peter Dyballa
  3 siblings, 1 reply; 6+ messages in thread
From: Tim X @ 2005-05-04  8:19 UTC (permalink / raw)


"Jeffrey L. Greer" <jlgreer1@excite.com> writes:

> I am trying to configure automatic time-stamp for emacs 21 in a Debian
> Sarge system. I have the following .emacs file in my home directory. I
> have read and re-read what seems to be the relevant pages in the hard
> copy of Gnu Emacs Manual. Time stamp will only work manually.
>
> Suggestions please? Thank you, Jeff Greer

I use the time-stamp command to insert a created time and last
modified time via a 'tempo' skeleton template I have. This works really well -
when I insert the skeleton I get this

>       Filename: /home/tcross/News/drafts/drafts/2
>  Creation Date: Wednesday, 04 May 2005 06:13 PM EST
>  Last Modified: 
>            Job: 
>         Author: Tim Cross <tcross@pobox.une.edu.au>
>    Description: 
>    

The Last Modified field is updated each time I save the file. The
relevant time-stamp stuff from my .emacs is

(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
(setq time-stamp-format "%:a, %02d %:b %:y %02I:%02M %#P %Z")
(setq time-stamp-start "\\(Time-stamp:[         ]+\\\\?[\"<]+\\|Last Modified:[ 
        ]\\)")
(setq time-stamp-end "\\\\?[\">]\\|$")
(setq time-stamp-line-limit 10)

The template is

(tempo-define-template "generic-header"
					   '((format "%s" comment-start) 
						 "      Filename: " (buffer-file-name) '> 'n
						 (format "%s" comment-start) " Creation Date: "
						 (format-time-string "%A, %d %B %Y %I:%M %p %Z") '> 'n
						 (format "%s" comment-start) " Last Modified: " '> 'n
						 (format "%s" comment-start) 
						 "           Job: " (p "Job: ") '> 'n
						 (format "%s" comment-start) 
						 "        Author: Tim Cross <tcross@pobox.une.edu.au>"
						 '> 'n
						 (format "%s" comment-start) "   Description:" '> 'n
						 (format "%s" comment-start) '> 'n
						 'n))


HTH

Tim
-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

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

* Re: automatic time-stamp
  2005-05-04  8:19 ` Tim X
@ 2005-05-04 10:48   ` Jeffrey L. Greer
  0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey L. Greer @ 2005-05-04 10:48 UTC (permalink / raw)


Thanks for the replies! I appreciate all of you taking time to help.

Tim provided a number of new techniques to use. I will incorporate them
this evening when I return from work.

Thanks again, Jeff

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

* Re: automatic time-stamp
  2005-05-03 23:49 automatic time-stamp Jeffrey L. Greer
                   ` (2 preceding siblings ...)
  2005-05-04  8:19 ` Tim X
@ 2005-05-04 20:58 ` Peter Dyballa
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2005-05-04 20:58 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 04.05.2005 um 01:49 schrieb Jeffrey L. Greer:

> I am trying to configure automatic time-stamp for emacs 21

For me this worked on a few platforms:

	(add-hook 'write-file-hooks 'time-stamp)

+ a customization like

	 '(time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u")

+ a manual addition to the file in its header like

	;    Time-stamp: <2005-05-03 18:39:53 pete>

This gets updated whenever you save the file. time-stamp-active is t by 
default as defined in time-stamp.el.

--
Greetings

   Pete

We are usually convinced more easily by reasons we have found ourselves 
than by those which have occurred to others.
(Blaise Pascal)

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

end of thread, other threads:[~2005-05-04 20:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-03 23:49 automatic time-stamp Jeffrey L. Greer
2005-05-04  6:46 ` Peter Tury
2005-05-04  6:50 ` Holger Sparr
2005-05-04  8:19 ` Tim X
2005-05-04 10:48   ` Jeffrey L. Greer
2005-05-04 20:58 ` Peter Dyballa

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