1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

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'.
This commit is contained in:
Juanma Barranquero 2011-04-06 21:38:46 +02:00
parent 67a22325ce
commit 3e214b503e
5 changed files with 31 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2011-04-06 Juanma Barranquero <lekktu@gmail.com>
* NEWS: New variable `revert-buffer-in-progress-p'.
2011-03-22 Sebastian Hermida <sebas00@gmail.com>
* themes/misterioso-theme.el: New file.

View File

@ -886,6 +886,9 @@ time you call `progress-reporter-update' on that progress reporter,
with a nil or omitted VALUE argument, the reporter message is
displayed with a "spinning bar".
** New variable `revert-buffer-in-progress-p' is true while a buffer is
being reverted, even if the buffer has a local `revert-buffer-function'.
* Changes in Emacs 24.1 on non-free operating systems

View File

@ -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.

View File

@ -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

View File

@ -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)))))