Mercurial > emacs
comparison lispref/files.texi @ 53531:5bd5de5e98c2
(Saving Buffers): Clarify descriptions of `write-contents-functions'
and `before-save-hook'. Make the defvar's for `before-save-hook' and
`after-save-hook' into defopt's.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Wed, 07 Jan 2004 20:38:22 +0000 |
parents | 780b9eb8b58e |
children | a679a0134e06 |
comparison
equal
deleted
inserted
replaced
53530:eff208c6f20a | 53531:5bd5de5e98c2 |
---|---|
402 @c Emacs 19 feature | 402 @c Emacs 19 feature |
403 @defvar write-contents-functions | 403 @defvar write-contents-functions |
404 This works just like @code{write-file-functions}, but it is intended for | 404 This works just like @code{write-file-functions}, but it is intended for |
405 hooks that pertain to the contents of the file, as opposed to hooks that | 405 hooks that pertain to the contents of the file, as opposed to hooks that |
406 pertain to where the file came from. Such hooks are usually set up by | 406 pertain to where the file came from. Such hooks are usually set up by |
407 major modes, as buffer-local bindings for this variable. | 407 major modes, as buffer-local bindings for this variable. If any of the |
408 functions in this hook returns non-@code{nil}, @code{write-file-functions} | |
409 is not run. | |
408 | 410 |
409 This variable automatically becomes buffer-local whenever it is set; | 411 This variable automatically becomes buffer-local whenever it is set; |
410 switching to a new major mode always resets this variable. | 412 switching to a new major mode always resets this variable, but |
413 calling @code{set-visited-file-name} does not. | |
411 @end defvar | 414 @end defvar |
412 | 415 |
413 @defvar before-save-hook | 416 @defopt before-save-hook |
414 This normal hook runs before a buffer has been saved in its visited | 417 This normal hook runs before a buffer is saved in its visited file, |
415 file. One use of this hook is for the Copyright package; it uses this | 418 regardless of whether that is done normally or by one of the hooks |
416 hook to make sure the file has the current year in the copyright | 419 described above. One use of this hook is for the Copyright package; |
417 header. | 420 it uses this hook to make sure the file has the current year in the |
418 @end defvar | 421 copyright header. |
422 @end defopt | |
419 | 423 |
420 @c Emacs 19 feature | 424 @c Emacs 19 feature |
421 @defvar after-save-hook | 425 @defopt after-save-hook |
422 This normal hook runs after a buffer has been saved in its visited file. | 426 This normal hook runs after a buffer has been saved in its visited file. |
423 One use of this hook is in Fast Lock mode; it uses this hook to save the | 427 One use of this hook is in Fast Lock mode; it uses this hook to save the |
424 highlighting information in a cache file. | 428 highlighting information in a cache file. |
425 @end defvar | 429 @end defopt |
426 | 430 |
427 @defvar file-precious-flag | 431 @defvar file-precious-flag |
428 If this variable is non-@code{nil}, then @code{save-buffer} protects | 432 If this variable is non-@code{nil}, then @code{save-buffer} protects |
429 against I/O errors while saving by writing the new file to a temporary | 433 against I/O errors while saving by writing the new file to a temporary |
430 name instead of the name it is supposed to have, and then renaming it to | 434 name instead of the name it is supposed to have, and then renaming it to |
2454 shown above; the details are crucial for proper behavior in the case of | 2458 shown above; the details are crucial for proper behavior in the case of |
2455 multiple handlers, and for operations that have two file names that may | 2459 multiple handlers, and for operations that have two file names that may |
2456 each have handlers. | 2460 each have handlers. |
2457 | 2461 |
2458 @kindex safe-magic (@r{property}) | 2462 @kindex safe-magic (@r{property}) |
2459 Handlers that don't really do anything specal for actual access to the | 2463 Handlers that don't really do anything special for actual access to the |
2460 file---such as the ones that implement completion of host names for | 2464 file---such as the ones that implement completion of host names for |
2461 remote file names---should have a non-@code{nil} @code{safe-magic} | 2465 remote file names---should have a non-@code{nil} @code{safe-magic} |
2462 property. For instance, Emacs normally ``protects'' directory names | 2466 property. For instance, Emacs normally ``protects'' directory names |
2463 it finds in @code{PATH} from becoming magic, if they look like magic | 2467 it finds in @code{PATH} from becoming magic, if they look like magic |
2464 file names, by prefixing them with @samp{/:}. But if the handler that | 2468 file names, by prefixing them with @samp{/:}. But if the handler that |