diff options
| author | Jim Blandy <jimb@redhat.com> | 1992-04-04 05:55:39 +0000 |
|---|---|---|
| committer | Jim Blandy <jimb@redhat.com> | 1992-04-04 05:55:39 +0000 |
| commit | 8c0e7b739deaa08033e465190a0cb9f98d054062 (patch) | |
| tree | 8ecec9af8e54b85a5584012c982a290dc7efb785 /lisp/files.el | |
| parent | 08564963293aac2ea90a3dee54f48ded962238eb (diff) | |
| download | emacs-8c0e7b739deaa08033e465190a0cb9f98d054062.tar.gz | |
*** empty log message ***
Diffstat (limited to 'lisp/files.el')
| -rw-r--r-- | lisp/files.el | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/lisp/files.el b/lisp/files.el index ed2882eddeb..d3827b4126d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1,5 +1,5 @@ ;; File input and output commands for Emacs -;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -147,7 +147,19 @@ functions are called.") (defvar write-file-hooks nil "List of functions to be called before writing out a buffer to a file. If one of them returns non-nil, the file is considered already written -and the rest are not called.") +and the rest are not called. +These hooks are considered to pertain to the visited file. +So this list is cleared if you change the visited file name. +See also `write-contents-hooks'.") + +(defvar write-contents-hooks nil + "List of functions to be called before writing out a buffer to a file. +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 buffer's contents, +not to the particular visited file; thus, `set-visited-file-name' does +not clear this variable, but changing the major mode does clear it. +See also `write-file-hooks'.") (defconst enable-local-variables t "*Control use of local-variables lists in files you visit. @@ -932,7 +944,7 @@ the last real save, but optional arg FORCE non-nil means delete anyway." (save-excursion (goto-char (point-max)) (insert ?\n))) - (let ((hooks write-file-hooks) + (let ((hooks (append write-contents-hooks write-file-hooks)) (done nil)) (while (and hooks (not (setq done (funcall (car hooks))))) @@ -1127,22 +1139,21 @@ or multiple mail buffers, etc." Gets two args, first the nominal file name to use, and second, t if reading the auto-save file.") -(defun revert-buffer (&optional arg noconfirm) +(defun revert-buffer (&optional check-auto noconfirm) "Replace the buffer text with the text of the visited file on disk. This undoes all changes since the file was visited or saved. -If latest auto-save file is more recent than the visited file, -asks user whether to use that instead. - -Optional first argument ARG means don't offer to use auto-save file. -This is the prefix arg when called interactively. +With a prefix argument, offer to revert from latest auto-save file, if +that is more recent than the visited file. +When called from lisp, this is the first argument, CHECK-AUTO; it is optional. Optional second argument NOCONFIRM means don't ask for confirmation at all. -If `revert-buffer-function' value is non-nil, it is called to do the work." +If the value of `revert-buffer-function' is non-nil, it is called to +do the work." (interactive "P") (if revert-buffer-function - (funcall revert-buffer-function arg noconfirm) + (funcall revert-buffer-function (not check-auto) noconfirm) (let* ((opoint (point)) - (auto-save-p (and (null arg) (recent-auto-save-p) + (auto-save-p (and check-auto (recent-auto-save-p) buffer-auto-save-file-name (file-readable-p buffer-auto-save-file-name) (y-or-n-p |
