comparison lisp/files.el @ 87268:176116c3fd05

return back entry: revert-buffer should eliminate overlays and the mark
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Wed, 12 Dec 2007 01:18:26 +0000
parents 415e3088cd6c
children 3cad137a4fe8
comparison
equal deleted inserted replaced
87267:7561d0f34da7 87268:176116c3fd05
4202 "Replace current buffer text with the text of the visited file on disk. 4202 "Replace current buffer text with the text of the visited file on disk.
4203 This undoes all changes since the file was visited or saved. 4203 This undoes all changes since the file was visited or saved.
4204 With a prefix argument, offer to revert from latest auto-save file, if 4204 With a prefix argument, offer to revert from latest auto-save file, if
4205 that is more recent than the visited file. 4205 that is more recent than the visited file.
4206 4206
4207 This command also implements an interface for special buffers 4207 This command also works for special buffers that contain text which
4208 that contain text which doesn't come from a file, but reflects 4208 doesn't come from a file, but reflects some other data base instead:
4209 some other data instead (e.g. Dired buffers, `buffer-list' 4209 for example, Dired buffers and `buffer-list' buffers. In these cases,
4210 buffers). This is done via the variable 4210 it reconstructs the buffer contents from the appropriate data base.
4211 `revert-buffer-function'. In these cases, it should reconstruct
4212 the buffer contents from the appropriate data.
4213 4211
4214 When called from Lisp, the first argument is IGNORE-AUTO; only offer 4212 When called from Lisp, the first argument is IGNORE-AUTO; only offer
4215 to revert from the auto-save file when this is nil. Note that the 4213 to revert from the auto-save file when this is nil. Note that the
4216 sense of this argument is the reverse of the prefix argument, for the 4214 sense of this argument is the reverse of the prefix argument, for the
4217 sake of backward compatibility. IGNORE-AUTO is optional, defaulting 4215 sake of backward compatibility. IGNORE-AUTO is optional, defaulting
4323 (if preserve-modes 4321 (if preserve-modes
4324 (let ((buffer-file-format buffer-file-format)) 4322 (let ((buffer-file-format buffer-file-format))
4325 (insert-file-contents file-name (not auto-save-p) 4323 (insert-file-contents file-name (not auto-save-p)
4326 nil nil t)) 4324 nil nil t))
4327 (insert-file-contents file-name (not auto-save-p) 4325 (insert-file-contents file-name (not auto-save-p)
4328 nil nil t)) 4326 nil nil t)))))
4329 ;; Reset the mark and remove all overlays.
4330 (setq mark-active nil
4331 mark-ring nil)
4332 (remove-overlays))))
4333 ;; Recompute the truename in case changes in symlinks 4327 ;; Recompute the truename in case changes in symlinks
4334 ;; have changed the truename. 4328 ;; have changed the truename.
4335 (setq buffer-file-truename 4329 (setq buffer-file-truename
4336 (abbreviate-file-name (file-truename buffer-file-name))) 4330 (abbreviate-file-name (file-truename buffer-file-name)))
4337 (after-find-file nil nil t t preserve-modes) 4331 (after-find-file nil nil t t preserve-modes)