Eric Blake wrote (on Tue, 22 Feb 2011 at 16:38 -0700): > > Firstly, a minor point. write-file-hooks is obsolete since Emacs 22.1, > > replaced by write-file-functions. (Actually, the Emacs documentation > > suggests using before-save-hook for time-stamping.) > > And what's the portable fallback, for files that might be maintained on > older emacs?
If you want to be compatible with Emacs older than 22.1, stick with write-file-hooks (it might go away in some distant future Emacs). Otherwise you can use before-save-hook. > Do you have a suggestion for an alternate way to ensure that the > timestamps are consistently updated when edited in their primary > upstream repo, without the use of the eval? For example, would creating > a .dir-locals.el in the same repository do the trick? And, showing how > little I know about .dir-locals.el, what would its contents have to be > to take the place of the eval? Wow, you require everyone with commit rights to use Emacs? ;) Actually, I discovered that Emacs has a feature for this (of course)! `safe-local-eval-forms' contains eval: things that are actually safe. By default, it includes: (add-hook 'write-file-functions 'time-stamp) (add-hook 'before-save-hook 'time-stamp) So if you change to using 'before-save-hook, there will no longer be a confirmation prompt. Or I guess we should add: (add-hook 'write-file-hooks 'time-stamp) to the default list as long as write-file-hooks is still supported in Emacs. With regards to dir-locals, I think you can do it using a file containing: ((nil . ((eval . (add-hook 'before-save-hook 'time-stamp))))) This requires Emacs >= 23.1. For some reason, Emacs < 23.2 will warn about that evalling that form.