|
From: | Earl Chew |
Subject: | Re: Proposed feature - Optionally generate gtags for gtags-visit-rootdir |
Date: | Tue, 13 Oct 2015 19:05:00 -0700 |
User-agent: | K-9 Mail for Android |
Hi,Thank you for the patch.I would like to take over this matter. I had forgotten, butthis option should work in TRAMP environment. However, TRAMPfacility of gtags.el is almost undocumented. So, please letme do it. It takes time a little though.Regards,Shigio2015-10-12 3:10 GMT+09:00 Earl Chew <address@hidden>:On 8/10/2015 21:15, Shigio YAMAGUCHI wrote:
I agree with you.
No problem with 1).
What do you think about this attempt ?
Earl
--- gtags.el.orig 2015-10-11 10:28:05.269639542 -0700
+++ gtags.el 2015-10-11 11:06:05.468301202 -0700
@@ -197,12 +197,19 @@
"Root directory of source tree.")
(defvar gtags-global-command nil
"Command name of global.")
+(defvar gtags-command nil
+ "Command name of gtags.")
;; Set global's command name
(setq gtags-global-command (getenv "GTAGSGLOBAL"))
(if (or (not gtags-global-command) (equal gtags-global-command ""))
(setq gtags-global-command "global"))
+;; Set global's command name
+(setq gtags-command (getenv "GTAGS"))
+(if (or (not gtags-command) (equal gtags-command ""))
+ (setq gtags-command "gtags"))
+
;; Key mapping of gtags-mode.
(if gtags-suggested-key-mapping
(progn
@@ -512,9 +519,9 @@
;;
;; interactive command
;;
-(defun gtags-visit-rootdir ()
+(defun gtags-visit-rootdir (arg)
"Tell tags commands the root directory of source tree."
- (interactive)
+ (interactive "P")
(let (path input default-path)
(setq path gtags-rootdir)
(if (not path)
@@ -530,7 +537,21 @@
(if (not (file-directory-p input))
(message "%s is not directory." input)
(setq gtags-rootdir (expand-file-name input))
- (setenv "GTAGSROOT" gtags-rootdir)))))
+ (setenv "GTAGSROOT" gtags-rootdir)
+ (when arg
+ (let (stdout)
+ (message "Building gtags %s" gtags-rootdir)
+ (gtags-push-tramp-environment)
+ (setq stdout
+ (shell-command-to-string
+ (format "exec %s"
+ (shell-quote-argument gtags-command))))
+ (gtags-pop-tramp-environment)
+ (message "Built gtags %s%s"
+ gtags-rootdir
+ (if (= 0 (length stdout))
+ ""
+ (concat ": " stdout)))))))))
(defun gtags-find-tag (&optional other-win)
"Input tag name and move to the definition."
--Shigio YAMAGUCHI <address@hidden>PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3
[Prev in Thread] | Current Thread | [Next in Thread] |