8 Maintaining Timestamps in Modified Files

The time-stamp command can be used to update automatically a template in a file with a new time stamp every time you save the file. Customize the hook before-save-hook to add the function time-stamp to arrange this. It you use Custom to do this, then time-stamp is conveniently listed as an option in the customization buffer.

The time stamp is updated only if the customizable variable time-stamp-active is on, which it is by default; the command time-stamp-toggle-active can be used to toggle it. The format of the time stamp is set by the customizable variables time-stamp-format and time-stamp-time-zone.

The variables time-stamp-line-limit, time-stamp-start, time-stamp-end, time-stamp-count, and time-stamp-inserts-lines control finding the template. Do not change these in your init file or you will be incompatible with other people’s files. If you must change them, do so only in the local variables section of the file itself.

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>