aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-26 07:28:20 +0000
committerRichard M. Stallman1993-03-26 07:28:20 +0000
commitc9dca4e0924e5469402b183e7f2c79e8ea577268 (patch)
treec619d71f4dd38ba932ff421c53daf52be1f70e0e
parent8b2120f4fffb001dcbe2d27b92e5bfe541f798cd (diff)
downloademacs-c9dca4e0924e5469402b183e7f2c79e8ea577268.tar.gz
emacs-c9dca4e0924e5469402b183e7f2c79e8ea577268.zip
(local-write-file-hooks): New variable.
(set-visited-file-name): Kill local-write-file-hooks as local var. (basic-save-buffer): Use local-write-file-hooks.
-rw-r--r--lisp/files.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index dc2d39319ec..2a5e298b60f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -180,6 +180,7 @@ The functions are called in the order given until one of them returns non-nil.")
180The buffer's local variables (if any) will have been processed before the 180The buffer's local variables (if any) will have been processed before the
181functions are called.") 181functions are called.")
182 182
183;;; In case someone does make it local.
183(put 'write-file-hooks 'permanent-local t) 184(put 'write-file-hooks 'permanent-local t)
184(defvar write-file-hooks nil 185(defvar write-file-hooks nil
185 "List of functions to be called before writing out a buffer to a file. 186 "List of functions to be called before writing out a buffer to a file.
@@ -187,7 +188,14 @@ If one of them returns non-nil, the file is considered already written
187and the rest are not called. 188and the rest are not called.
188These hooks are considered to pertain to the visited file. 189These hooks are considered to pertain to the visited file.
189So this list is cleared if you change the visited file name. 190So this list is cleared if you change the visited file name.
190See also `write-contents-hooks'.") 191See also `write-contents-hooks'.
192Don't make this variable buffer-local; instead, use `local-write-file-hooks'.")
193
194(put 'local-write-file-hooks 'permanent-local t)
195(defvar local-write-file-hooks nil
196 "Just like `write-file-hooks', except intended for per-buffer use.
197The functions in this list are called before the ones in
198`write-file-hooks'.")
191 199
192(defvar write-contents-hooks nil 200(defvar write-contents-hooks nil
193 "List of functions to be called before writing out a buffer to a file. 201 "List of functions to be called before writing out a buffer to a file.
@@ -918,6 +926,7 @@ if you wish to pass an empty string as the argument."
918 ;; that visit things that are not local files as if they were files. 926 ;; that visit things that are not local files as if they were files.
919 ;; Changing to visit an ordinary local file instead should flush the hook. 927 ;; Changing to visit an ordinary local file instead should flush the hook.
920 (kill-local-variable 'write-file-hooks) 928 (kill-local-variable 'write-file-hooks)
929 (kill-local-variable 'local-write-file-hooks)
921 (kill-local-variable 'revert-buffer-function) 930 (kill-local-variable 'revert-buffer-function)
922 (kill-local-variable 'backup-inhibited) 931 (kill-local-variable 'backup-inhibited)
923 ;; Turn off backup files for certain file names. 932 ;; Turn off backup files for certain file names.
@@ -1244,7 +1253,8 @@ the last real save, but optional arg FORCE non-nil means delete anyway."
1244 (save-excursion 1253 (save-excursion
1245 (goto-char (point-max)) 1254 (goto-char (point-max))
1246 (insert ?\n))) 1255 (insert ?\n)))
1247 (let ((hooks (append write-contents-hooks write-file-hooks)) 1256 (let ((hooks (append write-contents-hooks local-write-file-hooks
1257 write-file-hooks))
1248 (done nil)) 1258 (done nil))
1249 (while (and hooks 1259 (while (and hooks
1250 (not (setq done (funcall (car hooks))))) 1260 (not (setq done (funcall (car hooks)))))