Mercurial > hg > xemacs-beta
diff lisp/files.el @ 849:503b6a57cf47
[xemacs-hg @ 2002-05-21 10:29:07 by stephent]
revert-buffer docs, eldap.c <87hel1er8q.fsf@tleepslib.sk.tsukuba.ac.jp> <87d6vper2g.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Tue, 21 May 2002 10:29:15 +0000 |
parents | 047d37eb70d7 |
children | e7ee5f8bde58 |
line wrap: on
line diff
--- a/lisp/files.el Fri May 17 18:28:45 2002 +0000 +++ b/lisp/files.el Tue May 21 10:29:15 2002 +0000 @@ -2764,7 +2764,9 @@ (defvar revert-buffer-insert-file-contents-function nil "Function to use to insert contents when reverting this buffer. Gets two args, first the nominal file name to use, -and second, t if reading the auto-save file.") +and second, t if reading the auto-save file. +If the current buffer contents are to be discarded, the function must do +so itself.") (defvar before-revert-hook nil "Normal hook for `revert-buffer' to run before reverting. @@ -2789,10 +2791,10 @@ With a prefix argument, offer to revert from latest auto-save file, if that is more recent than the visited file. -This command also works for special buffers that contain text which -doesn't come from a file, but reflects some other data base instead: -for example, Dired buffers and buffer-list buffers. In these cases, -it reconstructs the buffer contents from the appropriate data base. +This command also refreshes certain special buffers that contain text +which doesn't come from a file, but reflects some other data base +instead: for example, Dired buffers and buffer-list buffers. This is +implemented by having the modes set `revert-buffer-function'. When called from Lisp, the first argument is IGNORE-AUTO; only offer to revert from the auto-save file when this is nil. Note that the @@ -2804,7 +2806,7 @@ all. Optional third argument PRESERVE-MODES non-nil means don't alter -the files modes. Normally we reinitialize them using `normal-mode'. +the buffer's modes. Otherwise, reinitialize them using `normal-mode'. If the value of `revert-buffer-function' is non-nil, it is called to do all the work for this command. Otherwise, the hooks @@ -2812,10 +2814,9 @@ and the end, and if `revert-buffer-insert-file-contents-function' is non-nil, it is called instead of rereading visited file contents. -If the buffer has not been obviously modified, and no auto-save file -exists, then `revert-buffer-internal' is -called. `revert-buffer-internal' will not actually change the buffer -at all if reversion would not cause any user-visible changes." +If the buffer-modified flag is nil, and we are not reverting from an +auto-save file, then compare the contents of the buffer and the file. +Revert only if they differ." ;; I admit it's odd to reverse the sense of the prefix argument, but ;; there is a lot of code out there which assumes that the first @@ -2968,6 +2969,9 @@ t))))) (defun revert-buffer-internal (&optional file-name) + "Read contents of FILE-NAME into a buffer, and compare to current buffer. +Return nil if identical, and the new buffer if different." + (let* ((newbuf (get-buffer-create " *revert*")) bmin bmax) (save-excursion