Function: etags-regen--tags-generate

etags-regen--tags-generate is a byte-compiled function defined in etags-regen.el.gz.

Signature

(etags-regen--tags-generate PROJ)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags-regen.el.gz
(defun etags-regen--tags-generate (proj)
  (let* ((root (project-root proj))
         (default-directory root)
         (files (etags-regen--all-files proj))
         (tags-file (etags-regen--choose-tags-file proj))
         (fun (if (equal (file-name-directory tags-file)
                         (expand-file-name root))
                  #'file-relative-name #'file-local-name))
         (ctags-p (etags-regen--ctags-p))
         (command (format "%s %s %s - -o %s"
                          etags-regen-program
                          (mapconcat #'identity
                                     (etags-regen--build-program-options ctags-p)
                                     " ")
                          ;; ctags's etags requires '-L' for stdin input.
                          (if ctags-p "-L" "")
                          (shell-quote-argument (file-local-name tags-file)))))
    (with-temp-buffer
      (mapc (lambda (f)
              (insert (funcall fun f) "\n"))
            files)
      (with-connection-local-variables
       (etags-regen--process-file-region (point-min)
                                         (point-max)
                                         shell-file-name
                                         nil
                                         etags-regen--errors-buffer-name
                                         shell-command-switch
                                         command)))
    (etags-regen--visit-table tags-file root)))