20.3.6.2 Forcing Time Stamps for One File

If you are working on a file with multiple authors, and you cannot be sure the other authors have enabled time-stamping globally in their Emacs initialization files, you can force it to be enabled for a particular file by adding time-stamp to that buffer’s before-save-hook in that file’s local variables list. To extend one of the previous examples:

// Local variables:
// eval: (add-hook 'before-save-hook 'time-stamp nil t)
// time-stamp-pattern: "Published %Y in Boston"
// End:

Although this example shows them both set together, you can use eval without also setting time-stamp-pattern if you like the default pattern.

The extra arguments to add-hook used here, nil and t, are necessary to have the added hook affect only this buffer.