Variable: write-file-functions

write-file-functions is a variable defined in files.el.gz.

Value

nil

Documentation

List of functions to be called before saving a buffer to a file.

Used only by save-buffer. If one of them returns non-nil, the file is considered already written and the rest are not called. These hooks are considered to pertain to the visited file. So any buffer-local binding of this variable is discarded if you change the visited file name with M-x set-visited-file-name (set-visited-file-name), but not when you change the major mode.

This hook is not run if any of the functions in write-contents-functions returns non-nil. Both hooks pertain to how to save a buffer to file, for instance, choosing a suitable coding system and setting mode bits. (See Info
node (elisp)Saving Buffers.) To perform various checks or
updates before the buffer is saved, use before-save-hook.

Probably introduced at or before Emacs version 22.1.

Aliases

write-file-hooks (obsolete since 22.1)

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defvar write-file-functions nil
  "List of functions to be called before saving a buffer to a file.
Used only by `save-buffer'.
If one of them returns non-nil, the file is considered already written
and the rest are not called.
These hooks are considered to pertain to the visited file.
So any buffer-local binding of this variable is discarded if you change
the visited file name with \\[set-visited-file-name], but not when you
change the major mode.

This hook is not run if any of the functions in
`write-contents-functions' returns non-nil.  Both hooks pertain
to how to save a buffer to file, for instance, choosing a suitable
coding system and setting mode bits.  (See Info
node `(elisp)Saving Buffers'.)  To perform various checks or
updates before the buffer is saved, use `before-save-hook'.")