Using a Save Hook for an Automatically Updating "Last Modified" Timestamp

There are multiple ways that save hooks on GNU Emacs can be used for automatically updating timestamps. By default, Emacs will update timestamps in the first eight lines of a file. The lines would look like either: Time-stamp: <> Or: Time-stamp: "" In order for the timestamp to automatically change when you save a document, you need to add the save hook to your ~/.emacs file: (add-hook 'before-save-hook 'time-stamp) This is not the only way your timestamp can work, especially since it may be a bit awkward to look at an HTML document. Another way you can display timestamps would be how I do with my own web pages. To do this, you'll need to add the below code block to your .emacs file. (add-hook 'html-mode-hook (lambda () (set (make-local-variable 'time-stamp-pattern) "-8/<!--LASTMOD-->+%3a %d %3b %:y %02H:%02M:%02S %p %Z<!--END-->"))) The above code will look in the last 8 lines of the document, and will add the time stamp in between the below comments: <!--LASTMOD--> <!--END--> Notes:
Anton McClure / anton@aperture.nonpaged.com