diff options
| author | Simon Josefsson | 2004-01-05 18:17:41 +0000 |
|---|---|---|
| committer | Simon Josefsson | 2004-01-05 18:17:41 +0000 |
| commit | 3c3b81d190d9c1ada2dbc4926ec9a18e119463b2 (patch) | |
| tree | 7cbaa088db6e2a1c388b8b85fe528b5dd8294803 | |
| parent | 61e938eb8bc86570c2d86ba23c67300145f85181 (diff) | |
| download | emacs-3c3b81d190d9c1ada2dbc4926ec9a18e119463b2.tar.gz emacs-3c3b81d190d9c1ada2dbc4926ec9a18e119463b2.zip | |
(before-save-hook): Add.
(basic-save-buffer): Use before-save-hook.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/files.el | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a07b135eef..7276ccc1bf9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2003-12-31 Simon Josefsson <jas@extundo.com> | ||
| 2 | |||
| 3 | * files.el (before-save-hook): Add. | ||
| 4 | (basic-save-buffer): Use before-save-hook. | ||
| 5 | |||
| 1 | 2004-01-05 Richard M. Stallman <rms@gnu.org> | 6 | 2004-01-05 Richard M. Stallman <rms@gnu.org> |
| 2 | 7 | ||
| 3 | * finder.el (finder-commentary): Call delete-other-windows. | 8 | * finder.el (finder-commentary): Call delete-other-windows. |
diff --git a/lisp/files.el b/lisp/files.el index ec58906e485..e74ef0bcbc1 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2990,6 +2990,12 @@ the last real save, but optional arg FORCE non-nil means delete anyway." | |||
| 2990 | (defvar auto-save-hook nil | 2990 | (defvar auto-save-hook nil |
| 2991 | "Normal hook run just before auto-saving.") | 2991 | "Normal hook run just before auto-saving.") |
| 2992 | 2992 | ||
| 2993 | (defcustom before-save-hook nil | ||
| 2994 | "Normal hook that is run before a buffer is saved to its file." | ||
| 2995 | :options '(copyright-update) | ||
| 2996 | :type 'hook | ||
| 2997 | :group 'files) | ||
| 2998 | |||
| 2993 | (defcustom after-save-hook nil | 2999 | (defcustom after-save-hook nil |
| 2994 | "Normal hook that is run after a buffer is saved to its file." | 3000 | "Normal hook that is run after a buffer is saved to its file." |
| 2995 | :options '(executable-make-buffer-file-executable-if-script-p) | 3001 | :options '(executable-make-buffer-file-executable-if-script-p) |
| @@ -3012,7 +3018,8 @@ in such cases.") | |||
| 3012 | The hooks `write-contents-functions' and `write-file-functions' get a chance | 3018 | The hooks `write-contents-functions' and `write-file-functions' get a chance |
| 3013 | to do the job of saving; if they do not, then the buffer is saved in | 3019 | to do the job of saving; if they do not, then the buffer is saved in |
| 3014 | the visited file file in the usual way. | 3020 | the visited file file in the usual way. |
| 3015 | After saving the buffer, this function runs `after-save-hook'." | 3021 | Before and after saving the buffer, this function runs |
| 3022 | `before-save-hook' and `after-save-hook', respectively." | ||
| 3016 | (interactive) | 3023 | (interactive) |
| 3017 | (save-current-buffer | 3024 | (save-current-buffer |
| 3018 | ;; In an indirect buffer, save its base buffer instead. | 3025 | ;; In an indirect buffer, save its base buffer instead. |
| @@ -3068,6 +3075,7 @@ After saving the buffer, this function runs `after-save-hook'." | |||
| 3068 | (insert ?\n)))) | 3075 | (insert ?\n)))) |
| 3069 | ;; Support VC version backups. | 3076 | ;; Support VC version backups. |
| 3070 | (vc-before-save) | 3077 | (vc-before-save) |
| 3078 | (run-hooks 'before-save-hook) | ||
| 3071 | (or (run-hook-with-args-until-success 'write-contents-functions) | 3079 | (or (run-hook-with-args-until-success 'write-contents-functions) |
| 3072 | (run-hook-with-args-until-success 'local-write-file-hooks) | 3080 | (run-hook-with-args-until-success 'local-write-file-hooks) |
| 3073 | (run-hook-with-args-until-success 'write-file-functions) | 3081 | (run-hook-with-args-until-success 'write-file-functions) |