1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-06 11:55:48 +00:00

(tags-loop-revert-buffers): Value `ask' means to query the user interactively.

(next-file): Implement it.
This commit is contained in:
Chong Yidong 2008-02-01 23:23:54 +00:00
parent 967e1dd855
commit 580d92980c

View File

@ -1629,12 +1629,14 @@ where they were found."
(and (search-forward "\177" (save-excursion (end-of-line) (point)) t) (and (search-forward "\177" (save-excursion (end-of-line) (point)) t)
(re-search-backward re bol t))))) (re-search-backward re bol t)))))
(defcustom tags-loop-revert-buffers nil (defcustom tags-loop-revert-buffers 'ask
"*Non-nil means tags-scanning loops should offer to reread changed files. "Whether the tags-scanning loop should reread changed files.
These loops normally read each file into Emacs, but when a file This loop normally reads each file into Emacs, but when a file is
is already visited, they use the existing buffer. already visited, it uses the existing buffer.
When this flag is non-nil, they offer to revert the existing buffer If this variable is nil, the loop uses the existing buffer even
in the case where the file has changed since you visited it." if the file has changed since you visited it.
If the value is `ask', the loop offers to revert the buffer.
Any other non-nil value means to revert the buffer automatically."
:type 'boolean :type 'boolean
:group 'etags) :group 'etags)
@ -1696,6 +1698,14 @@ if the file was newly read in, the value is the filename."
;; if the files have changed on disk. ;; if the files have changed on disk.
(and buffer tags-loop-revert-buffers (and buffer tags-loop-revert-buffers
(not (verify-visited-file-modtime buffer)) (not (verify-visited-file-modtime buffer))
(or (not (eq tags-loop-revert-buffers 'ask))
noninteractive
(y-or-n-p
(format
(if (buffer-modified-p buffer)
"File %s changed on disk. Discard your edits? "
"File %s changed on disk. Reread from disk? ")
next)))
(with-current-buffer buffer (with-current-buffer buffer
(revert-buffer t))) (revert-buffer t)))
(if (not (and new novisit)) (if (not (and new novisit))