Commit 2df32500 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(revert-buffer): Don't preserve point here.

(revert-buffer-insert-file-contents-function): Doc fix.
parent 8f3c1d76
...@@ -2657,7 +2657,9 @@ which are the arguments that `revert-buffer' received.") ...@@ -2657,7 +2657,9 @@ which are the arguments that `revert-buffer' received.")
(defvar revert-buffer-insert-file-contents-function nil (defvar revert-buffer-insert-file-contents-function nil
"Function to use to insert contents when reverting this buffer. "Function to use to insert contents when reverting this buffer.
Gets two args, first the nominal file name to use, 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.
The function you specify is responsible for updating (or preserving) point.")
(defvar before-revert-hook nil (defvar before-revert-hook nil
"Normal hook for `revert-buffer' to run before reverting. "Normal hook for `revert-buffer' to run before reverting.
...@@ -2714,8 +2716,7 @@ non-nil, it is called instead of rereading visited file contents." ...@@ -2714,8 +2716,7 @@ non-nil, it is called instead of rereading visited file contents."
(interactive (list (not current-prefix-arg))) (interactive (list (not current-prefix-arg)))
(if revert-buffer-function (if revert-buffer-function
(funcall revert-buffer-function ignore-auto noconfirm) (funcall revert-buffer-function ignore-auto noconfirm)
(let* ((opoint (point)) (let* ((auto-save-p (and (not ignore-auto)
(auto-save-p (and (not ignore-auto)
(recent-auto-save-p) (recent-auto-save-p)
buffer-auto-save-file-name buffer-auto-save-file-name
(file-readable-p buffer-auto-save-file-name) (file-readable-p buffer-auto-save-file-name)
...@@ -2771,9 +2772,9 @@ non-nil, it is called instead of rereading visited file contents." ...@@ -2771,9 +2772,9 @@ non-nil, it is called instead of rereading visited file contents."
;; any code conversion. ;; any code conversion.
(if auto-save-p 'no-conversion (if auto-save-p 'no-conversion
coding-system-for-read))) coding-system-for-read)))
;; Note that this preserves point in an intelligent way.
(insert-file-contents file-name (not auto-save-p) (insert-file-contents file-name (not auto-save-p)
nil nil t)))) nil nil t))))
(goto-char (min opoint (point-max)))
;; Recompute the truename in case changes in symlinks ;; Recompute the truename in case changes in symlinks
;; have changed the truename. ;; have changed the truename.
(setq buffer-file-truename (setq buffer-file-truename
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment