Function: bib-etags
bib-etags is an interactive and byte-compiled function defined in
bib-cite.el.
Signature
(bib-etags &optional MASTERDIR)
Documentation
Invoke etags on all tex files of the document in directory MASTERDIR.
Store the TAGS file in the master-directory.
Expect errors if you use this outside of auctex or within a plain
single-file document. Also makes sure that the TAGS buffer is updated.
See variables bib-etags-command and bib-etags-filename.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/bib-cite.el
(defun bib-etags (&optional masterdir)
"Invoke etags on all tex files of the document in directory MASTERDIR.
Store the TAGS file in the master-directory.
Expect errors if you use this outside of auctex or within a plain
single-file document. Also makes sure that the TAGS buffer is updated.
See variables `bib-etags-command' and `bib-etags-filename'."
(interactive)
(require 'etags)
(let* ((the-file-list (bib-document-TeX-files))
(the-file (car the-file-list))
(dir (or masterdir (bib-master-directory)))
(the-tags-file (expand-file-name bib-etags-filename dir))
(the-tags-buffer (get-file-buffer the-tags-file)))
;; Create TAGS file with first TeX file (master file)
(shell-command (concat bib-etags-command the-tags-file " " the-file))
(setq the-file-list (cdr the-file-list))
;; Append to TAGS file for all other TeX files.
(while the-file-list
(setq the-file (car the-file-list))
(shell-command
(concat bib-etags-append-command the-tags-file " " the-file))
(setq the-file-list (cdr the-file-list)))
(if the-tags-buffer ;buffer existed; we must refresh it.
(with-current-buffer the-tags-buffer
(revert-buffer t t)))
;; Check value of tags-file-name against the-tags-file
(or (equal the-tags-file tags-file-name) ;make sure it's current
(visit-tags-table the-tags-file))
;; (set (make-local-variable 'tags-file-name) the-tags-file))
;; above should not be needed
;; Weird Bug:
;; (visit-tags-table-buffer) seems to get called twice when called by
;; find-tag on an undefined tag. The second time, it's in the TAGS
;; buffer and returns an error because TAGS buffer does have
;; tags-file-name set.
;; To get around this. I'm setting this variable in the TAGS buffer.
;; (Changed by Anders Stenman)
(if (get-file-buffer the-tags-file)
(with-current-buffer (get-file-buffer the-tags-file)
(setq-local tags-file-name the-tags-file))))
(if bib-document-TeX-files-warnings ;free variable loose in emacs!
(progn
(with-output-to-temp-buffer "*Help*"
(princ bib-document-TeX-files-warnings))
(setq bib-document-TeX-files-warnings nil) ;Reset
(bib-cite-fontify-red))))