Hi, I'm trying to add the delete-trailing-whitespace hook to the .dir-locals.el of a project. Because .dir-locals.el does not support adding hooks directly, I use an eval clause, as follows: ((nil (eval . (add-hook 'write-contents-functions 'delete-trailing-whitespace)))) write-contents-functions is a buffer local hook whereas write-file-hook and before-save-hook are not, so the above does not tamper with the user's preferences when editing files in other directories. The above is problematic however, because Emacs 23 asks the user whether to run this eval expression *every time the user opens a file in that directory*. Emacs 24 is better because it allows the user to say "yes" once and for all and have Emacs never ask again, but it still asks the first time. However, I have noticed that by default Emacs already blesses certain eval forms as being safe in .dir-locals.el and in mode lines. Here is the content of safe-local-eval-forms in emacs 23.1: ((add-hook (quote write-file-hooks) (quote time-stamp))) and emacs 24.1: ((add-hook (quote write-file-hooks) (quote time-stamp)) (add-hook (quote write-file-functions) (quote time-stamp)) (add-hook (quote before-save-hook) (quote time-stamp))) It seems as though, if evaluation forms that add 'time-stamp to various hooks that all run around the time a file is saved are deemed safe by default, surely evaluation forms that add 'delete-trailing-whitespace should equally be deemed safe by default. I have attached a patch at the end of this email that considers eval forms that add 'delete-trailing-whitespace to various hooks safe by default. But ideally this patch would be superseded by adding a mechanism that allows .dir-locals.el to add predefined functions to hooks (at least buffer local ones) without having to use eval. That way we wouldn't have to write patches such as this one for every new sensible stock function that people want to have executed on file saves. Regards, -- Mathieu