Mercurial > emacs
comparison lisp/files.el @ 87222:415e3088cd6c
revert-buffer eliminates overlays and the mark
author | Vinicius Jose Latorre <viniciusjl@ig.com.br> |
---|---|
date | Tue, 11 Dec 2007 00:26:52 +0000 |
parents | a99a2e8bc21e |
children | 176116c3fd05 |
comparison
equal
deleted
inserted
replaced
87221:9e7453c93f6d | 87222:415e3088cd6c |
---|---|
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 works for special buffers that contain text which | 4207 This command also implements an interface for special buffers |
4208 doesn't come from a file, but reflects some other data base instead: | 4208 that contain text which doesn't come from a file, but reflects |
4209 for example, Dired buffers and `buffer-list' buffers. In these cases, | 4209 some other data instead (e.g. Dired buffers, `buffer-list' |
4210 it reconstructs the buffer contents from the appropriate data base. | 4210 buffers). This is done via the variable |
4211 `revert-buffer-function'. In these cases, it should reconstruct | |
4212 the buffer contents from the appropriate data. | |
4211 | 4213 |
4212 When called from Lisp, the first argument is IGNORE-AUTO; only offer | 4214 When called from Lisp, the first argument is IGNORE-AUTO; only offer |
4213 to revert from the auto-save file when this is nil. Note that the | 4215 to revert from the auto-save file when this is nil. Note that the |
4214 sense of this argument is the reverse of the prefix argument, for the | 4216 sense of this argument is the reverse of the prefix argument, for the |
4215 sake of backward compatibility. IGNORE-AUTO is optional, defaulting | 4217 sake of backward compatibility. IGNORE-AUTO is optional, defaulting |
4321 (if preserve-modes | 4323 (if preserve-modes |
4322 (let ((buffer-file-format buffer-file-format)) | 4324 (let ((buffer-file-format buffer-file-format)) |
4323 (insert-file-contents file-name (not auto-save-p) | 4325 (insert-file-contents file-name (not auto-save-p) |
4324 nil nil t)) | 4326 nil nil t)) |
4325 (insert-file-contents file-name (not auto-save-p) | 4327 (insert-file-contents file-name (not auto-save-p) |
4326 nil nil t))))) | 4328 nil nil t)) |
4329 ;; Reset the mark and remove all overlays. | |
4330 (setq mark-active nil | |
4331 mark-ring nil) | |
4332 (remove-overlays)))) | |
4327 ;; Recompute the truename in case changes in symlinks | 4333 ;; Recompute the truename in case changes in symlinks |
4328 ;; have changed the truename. | 4334 ;; have changed the truename. |
4329 (setq buffer-file-truename | 4335 (setq buffer-file-truename |
4330 (abbreviate-file-name (file-truename buffer-file-name))) | 4336 (abbreviate-file-name (file-truename buffer-file-name))) |
4331 (after-find-file nil nil t t preserve-modes) | 4337 (after-find-file nil nil t t preserve-modes) |