Skip to content

Commit ed5bbee

Browse files
committed
tweak(citre): add a command to generate gtags.files
1 parent 48b10dd commit ed5bbee

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

modules/me-prog.el

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,34 @@
121121
(citre-use-project-root-when-creating-tags t)
122122
:init
123123
(defvar +citre-recursive-root-project-detection-files '(".tags/" ".repo/" ".citre_root"))
124+
(defvar +citre-gtags-recursive-files-list t)
125+
(defvar +citre-gtags-files-list-suffixes '("*.[chly]" "*.[ch]xx" "*.[ch]pp" "*.[ch]++" "*.cc" "*.hh"))
126+
(defvar +citre-gtags-files-list-ignored-directories '("CVS" "RCS" "SCCS" ".git" ".hg" ".bzr" ".cdv" ".pc" ".svn" "_MTN" "_darcs" "_sgbak" "debian"))
124127
:config
125128
(defun +citre-recursive-project-root ()
126129
"Search recursively until we find one of `+citre-recursive-root-project-detection-files'.
127130
Fall back to the default `citre--project-root'."
128-
(or
129-
(+directory-root-containing-file +citre-recursive-root-project-detection-files)
130-
;; Fall back to the default detection!
131-
(citre--project-root))))
131+
(or (+directory-root-containing-file +citre-recursive-root-project-detection-files)
132+
(citre--project-root))) ; Fall back to the default detection!
133+
134+
(defun +citre-gtags-find-files-command (&optional dir)
135+
(let* ((default-directory (or dir default-directory)))
136+
(concat
137+
"echo 'Creating list of files to index ...'\n"
138+
(find-cmd
139+
(unless +citre-gtags-recursive-files-list '(maxdepth "1"))
140+
`(prune (and (type "d") (name ,@+citre-gtags-files-list-ignored-directories)))
141+
`(iname ,@+citre-gtags-files-list-suffixes)
142+
'(type "f" "l")
143+
'(print))
144+
" > gtags.files\n"
145+
"echo 'Creating list of files to index ... done'\n")))
146+
147+
(defun +citre-gtags-create-list-of-files-to-index (top-directory)
148+
"Create a list of files to index in TOP-DIRECTORY."
149+
(interactive "DCreate file list in directory: ")
150+
(let* ((default-directory top-directory))
151+
(start-process-shell-command "+citre-gtags-files-list" "*+citre-gtags-files-list*" (+citre-gtags-find-files-command)))))
132152

133153
(use-package citre-config
134154
:straight citre

0 commit comments

Comments
 (0)