I prefer to use the older version of
find-tag, instead of the
xref library. I wrote a function to build the tag database, but I'm having trouble locating a good place to plug it in. The default behavior when a TAGS file cannot be located is for
visit-tags-table-buffer to generate an error message "File %s does not exist". By the time we get to that message, however, it is the end of the function and too late to build a new tags file. I would like to do this without breaking
Q: Where can I plug-in
tags-build so that I can call
find-tag and be on my merry way with a new TAGS file if one does not already exist?
(defun tags-build () "Build the TAGS datbase and set the default `tags-file-name'." (interactive) (let ((default-directory (file-name-as-directory (expand-file-name (read-directory-name ".../src directory: "))))) (set-process-sentinel (start-process "build-tags" nil "/bin/bash" "-c" "find . -iname \"*.c\" -or -iname \"*.h\" | xargs etags") `(lambda (p e) (when (= 0 (process-exit-status p)) (setq-default tags-file-name (expand-file-name "TAGS" ,default-directory)) (message "tags-file-name: %s" tags-file-name) tags-file-name)))))