I have copyright-update in write-file-hooks; it reminds me to update the copyright year when saving modified files.
xmtn-revision-get-file-revision calls write-file, which runs this hook with buffer-modified-p set to t, which means I am prompted to update the copyright on files I have not changed, when fetching them for diffing. I don't see any way to get write-file to _not_ set buffer-modified-p. I think this is a bug in Emacs; I'll raise it on emacs-devel. On the other hand, the lower level save functions do nothing if the buffer is not modified, so that makes some sense. Nor can I find a simpler save-buffer operation that sets the file coding method properly, without running all the hooks. As a work-around, I've added a binding of the variable copyright-update to nil; that suppresses this particular problem. But there are other hooks that could be a problem; delete-trailing-whitespace, for example. The purpose of xmtn-revision-get-file-revision seems to be (it doesn't have a doc string) to get the contents of a particular file revision into a buffer, and also into a file. Sometimes that file is a temp file (as in the diff case), sometimes a user-requested file (when retrieving an old revision for other reasons). If it is a temp file, then perhaps we don't need the file at all, only the buffer. That would avoid calling write-file. If it is a user-requested file, it would seem that using shell redirection to write the file directly from mtn output, and then having Emacs visit it, would be a better approach. That would also work for the temp file case, if we don't want to complicate the code with a "temp-file" option. -- -- Stephe _______________________________________________ Dvc-dev mailing list [email protected] https://mail.gna.org/listinfo/dvc-dev
