-
Notifications
You must be signed in to change notification settings - Fork 4
/
init-gnu-global.el
35 lines (30 loc) · 1.23 KB
/
init-gnu-global.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(defun m/gtags-command-finished (process event)
(message "%s: %s" process (replace-regexp-in-string (regexp-quote "\n")
""
event)))
(defun m/gtags-do-gtags-command-at-project-root (args)
"Run gtags command (with `ARGS' as a command line argument) at
the project root."
(let ((project-dir (or (locate-dominating-file default-directory ".git")
(locate-dominating-file default-directory "GTAGS"))))
(if (null project-dir)
(message "Couldn't find project dir!")
(message (format "Running `gtags %s' at %s" args project-dir))
(let ((update-process (start-process-shell-command "gtags-update"
nil
(format "cd %s && gtags %s"
project-dir
args))))
(set-process-sentinel update-process 'm/gtags-command-finished)))))
(defun m/gtags-update-tags-file ()
"Update the gtags tags file"
(interactive)
(m/gtags-do-gtags-command-at-project-root "-I"))
(defun m/gtags-update-tags-file-incrementally ()
"Update the gtags tags file"
(interactive)
(m/gtags-do-gtags-command-at-project-root "-iI"))
(defun m/recenter-ignoring-args (&rest args)
(recenter))
(setq ggtags-find-tag-hook 'm/recenter-ignoring-args)
(advice-add 'pop-tag-mark :after #'m/recenter-ignoring-args)