Function: etags-regen--refresh
etags-regen--refresh is a byte-compiled function defined in
etags-regen.el.gz.
Signature
(etags-regen--refresh PROJ)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/etags-regen.el.gz
(defun etags-regen--refresh (proj)
(save-excursion
(let* ((tags-file (etags-regen--choose-tags-file proj))
(tags-mtime (file-attribute-modification-time
(file-attributes tags-file)))
(all-mtimes (etags-regen--all-mtimes proj))
added-files
changed-files
removed-files)
(etags-regen--visit-table tags-file (project-root proj))
(set-buffer (get-file-buffer tags-file))
(dolist (file (tags-table-files))
(let ((mtime (gethash file all-mtimes)))
(cond
((null mtime)
(push file removed-files))
((time-less-p tags-mtime mtime)
(push file changed-files)
(remhash file all-mtimes))
(t
(remhash file all-mtimes)))))
(maphash
(lambda (key _value)
(push key added-files))
all-mtimes)
(if (> (+ (length added-files)
(length changed-files)
(length removed-files))
etags-regen--rescan-files-limit)
(progn
(message "etags-regen: Too many changes, falling back to full rescan")
(etags-regen--tags-cleanup))
(dolist (file (nconc removed-files changed-files))
(etags-regen--remove-tag file))
(when (or changed-files added-files)
(apply #'etags-regen--append-tags
(nconc changed-files added-files)))
(when (or changed-files added-files removed-files)
(let ((save-silently t)
(message-log-max nil))
(save-buffer 0)))))))