diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2011-04-06 21:38:46 +0200 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2011-04-06 21:38:46 +0200 |
commit | 3e214b503eaf5c8a02b7153e5ddaf40a2d6efb13 (patch) | |
tree | 5e88ed8e5431fe3e56e85be4cb76b99bd8b1e0f4 /lisp | |
parent | 67a22325cedc1fa04026e34e2ca8aff78942f541 (diff) | |
download | emacs-3e214b503eaf5c8a02b7153e5ddaf40a2d6efb13.tar.gz |
New variable `revert-buffer-in-progress-p'.
* lisp/files.el (after-find-file-from-revert-buffer): Remove variable.
(after-find-file): Dont' bind it.
(revert-buffer-in-progress-p): New variable.
(revert-buffer): Bind it.
Pass nil for `after-find-file-from-revert-buffer'.
* lisp/saveplace.el (save-place-find-file-hook): Use new variable
`rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
* etc/NEWS: New variable `revert-buffer-in-progress-p'.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 11 | ||||
-rw-r--r-- | lisp/files.el | 20 | ||||
-rw-r--r-- | lisp/saveplace.el | 2 |
3 files changed, 24 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca163104e0a..5bd55902b40 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2011-04-06 Juanma Barranquero <lekktu@gmail.com> + + * files.el (after-find-file-from-revert-buffer): Remove variable. + (after-find-file): Dont' bind it. + (revert-buffer-in-progress-p): New variable. + (revert-buffer): Bind it. + Pass nil for `after-find-file-from-revert-buffer'. + + * saveplace.el (save-place-find-file-hook): Use new variable + `rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'. + 2011-04-06 Glenn Morris <rgm@gnu.org> * Makefile.in (AUTOGEN_VCS): New variable. diff --git a/lisp/files.el b/lisp/files.el index e87c25f3575..6bfb4f00d32 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2100,10 +2100,8 @@ the file contents into it using `insert-file-contents-literally'." (confirm-nonexistent-file-or-buffer)))) (switch-to-buffer (find-file-noselect filename nil t))) -(defvar after-find-file-from-revert-buffer nil) - (defun after-find-file (&optional error warn noauto - after-find-file-from-revert-buffer + _after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function. Sets buffer mode, parses local variables. @@ -2111,8 +2109,8 @@ Optional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an error in reading the file. WARN non-nil means warn if there exists an auto-save file more recent than the visited file. NOAUTO means don't mess with auto-save mode. -Fourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER non-nil - means this call was from `revert-buffer'. +Fourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored +\(see `revert-buffer-in-progress-p' for similar functionality). Fifth arg NOMODES non-nil means don't alter the file's modes. Finishes by calling the functions in `find-file-hook' unless NOMODES is non-nil." @@ -5004,6 +5002,10 @@ hook functions. If `revert-buffer-function' is used to override the normal revert mechanism, this hook is not used.") +(defvar revert-buffer-in-progress-p nil + "Non-nil if a `revert-buffer' operation is in progress, nil otherwise. +This is true even if a `revert-buffer-function' is being used.") + (defvar revert-buffer-internal-hook) (defun revert-buffer (&optional ignore-auto noconfirm preserve-modes) @@ -5046,10 +5048,12 @@ non-nil, it is called instead of rereading visited file contents." ;; interface, but leaving the programmatic interface the same. (interactive (list (not current-prefix-arg))) (if revert-buffer-function - (funcall revert-buffer-function ignore-auto noconfirm) + (let ((revert-buffer-in-progress-p t)) + (funcall revert-buffer-function ignore-auto noconfirm)) (with-current-buffer (or (buffer-base-buffer (current-buffer)) (current-buffer)) - (let* ((auto-save-p (and (not ignore-auto) + (let* ((revert-buffer-in-progress-p t) + (auto-save-p (and (not ignore-auto) (recent-auto-save-p) buffer-auto-save-file-name (file-readable-p buffer-auto-save-file-name) @@ -5140,7 +5144,7 @@ non-nil, it is called instead of rereading visited file contents." ;; have changed the truename. (setq buffer-file-truename (abbreviate-file-name (file-truename buffer-file-name))) - (after-find-file nil nil t t preserve-modes) + (after-find-file nil nil t nil preserve-modes) ;; Run after-revert-hook as it was before we reverted. (setq-default revert-buffer-internal-hook global-hook) (if local-hook diff --git a/lisp/saveplace.el b/lisp/saveplace.el index c10b5cbb7ec..2d1586d895a 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@ -285,7 +285,7 @@ may have changed\) back to `save-place-alist'." (let ((cell (assoc buffer-file-name save-place-alist))) (if cell (progn - (or after-find-file-from-revert-buffer + (or revert-buffer-in-progress-p (goto-char (cdr cell))) ;; and make sure it will be saved again for later (setq save-place t))))) |