comparison lisp/progmodes/etags.el @ 23415:b511a32c37fd

(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.
author Richard M. Stallman <rms@gnu.org>
date Sun, 11 Oct 1998 22:17:03 +0000
parents acb6d2c4220b
children 70fafedc3c4c
comparison
equal deleted inserted replaced
23414:c9d093e48f15 23415:b511a32c37fd
1346 (beginning-of-line) 1346 (beginning-of-line)
1347 (let ((bol (point))) 1347 (let ((bol (point)))
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.
1353 These loops normally read each file into Emacs, but when a file
1354 is already visited, they use the existing buffer.
1355 When this flag is non-nil, they offer to revert the existing buffer
1356 in 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.
1354 1363
1355 A first argument of t (prefix arg, if interactive) initializes to the 1364 A first argument of t (prefix arg, if interactive) initializes to the
1396 (and novisit 1405 (and novisit
1397 (get-buffer " *next-file*") 1406 (get-buffer " *next-file*")
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.
1408 (set-buffer (get-buffer-create " *next-file*")) 1424 (set-buffer (get-buffer-create " *next-file*"))
1409 (kill-all-local-variables) 1425 (kill-all-local-variables)