aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-10-11 22:17:03 +0000
committerRichard M. Stallman1998-10-11 22:17:03 +0000
commitd5792fb2eb6bed6df37eb46547f3c8df3b464b36 (patch)
treecfca4d420d15db87eed540c097442059bc81250e
parentaf58447241a81e2a2516e6c9c53893520fe31834 (diff)
downloademacs-d5792fb2eb6bed6df37eb46547f3c8df3b464b36.tar.gz
emacs-d5792fb2eb6bed6df37eb46547f3c8df3b464b36.zip
(tags-loop-revert-buffers): New variable.
(next-file): Optionally offer to revert a file's buffer, if it has an existing buffer but the file has changed.
-rw-r--r--lisp/progmodes/etags.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 94e2c6438bd..816fc2054fa 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1348,6 +1348,15 @@ where they were found."
1348 (and (search-forward "\177" (save-excursion (end-of-line) (point)) t) 1348 (and (search-forward "\177" (save-excursion (end-of-line) (point)) t)
1349 (re-search-backward re bol t))))) 1349 (re-search-backward re bol t)))))
1350 1350
1351(defcustom tags-loop-revert-buffers nil
1352 "*Non-nil means tags-scanning loops should offer to reread changed files.
1353These loops normally read each file into Emacs, but when a file
1354is already visited, they use the existing buffer.
1355When this flag is non-nil, they offer to revert the existing buffer
1356in the case where the file has changed since you visited it."
1357 :type 'boolean
1358 :group 'etags)
1359
1351;;;###autoload 1360;;;###autoload
1352(defun next-file (&optional initialize novisit) 1361(defun next-file (&optional initialize novisit)
1353 "Select next file among files in current tags table. 1362 "Select next file among files in current tags table.
@@ -1398,10 +1407,17 @@ if the file was newly read in, the value is the filename."
1398 (kill-buffer " *next-file*")) 1407 (kill-buffer " *next-file*"))
1399 (error "All files processed")) 1408 (error "All files processed"))
1400 (let* ((next (car next-file-list)) 1409 (let* ((next (car next-file-list))
1401 (new (not (get-file-buffer next)))) 1410 (buffer (get-file-buffer next))
1411 (new (not buffer)))
1402 ;; Advance the list before trying to find the file. 1412 ;; Advance the list before trying to find the file.
1403 ;; If we get an error finding the file, don't get stuck on it. 1413 ;; If we get an error finding the file, don't get stuck on it.
1404 (setq next-file-list (cdr next-file-list)) 1414 (setq next-file-list (cdr next-file-list))
1415 ;; Optionally offer to revert buffers
1416 ;; if the files have changed on disk.
1417 (and buffer tags-loop-revert-buffers
1418 (not (verify-visited-file-modtime buffer))
1419 (with-current-buffer buffer
1420 (revert-buffer t)))
1405 (if (not (and new novisit)) 1421 (if (not (and new novisit))
1406 (set-buffer (find-file-noselect next novisit)) 1422 (set-buffer (find-file-noselect next novisit))
1407 ;; Like find-file, but avoids random warning messages. 1423 ;; Like find-file, but avoids random warning messages.