Mercurial > emacs
diff lisp/files.el @ 53503:8995f4286209
(before-save-hook): Add.
(basic-save-buffer): Use before-save-hook.
author | Simon Josefsson <jas@extundo.com> |
---|---|
date | Mon, 05 Jan 2004 18:17:41 +0000 |
parents | 79093b308520 |
children | 2e7e8047b338 |
line wrap: on
line diff
--- a/lisp/files.el Mon Jan 05 13:59:08 2004 +0000 +++ b/lisp/files.el Mon Jan 05 18:17:41 2004 +0000 @@ -2990,6 +2990,12 @@ (defvar auto-save-hook nil "Normal hook run just before auto-saving.") +(defcustom before-save-hook nil + "Normal hook that is run before a buffer is saved to its file." + :options '(copyright-update) + :type 'hook + :group 'files) + (defcustom after-save-hook nil "Normal hook that is run after a buffer is saved to its file." :options '(executable-make-buffer-file-executable-if-script-p) @@ -3012,7 +3018,8 @@ The hooks `write-contents-functions' and `write-file-functions' get a chance to do the job of saving; if they do not, then the buffer is saved in the visited file file in the usual way. -After saving the buffer, this function runs `after-save-hook'." +Before and after saving the buffer, this function runs +`before-save-hook' and `after-save-hook', respectively." (interactive) (save-current-buffer ;; In an indirect buffer, save its base buffer instead. @@ -3068,6 +3075,7 @@ (insert ?\n)))) ;; Support VC version backups. (vc-before-save) + (run-hooks 'before-save-hook) (or (run-hook-with-args-until-success 'write-contents-functions) (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions)