[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 12/18: Make ggtags-use-project-gtagsconf work on remote projects
From: |
Leo Liu |
Subject: |
[elpa] 12/18: Make ggtags-use-project-gtagsconf work on remote projects |
Date: |
Sat, 05 Apr 2014 01:25:16 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 6ffc5421828984ef9b56500741779baa5bb7dbf1
Author: Leo Liu <address@hidden>
Date: Thu Apr 3 10:17:42 2014 +0800
Make ggtags-use-project-gtagsconf work on remote projects
by using --gtagsconf instead of setenv'ing GTAGSCONF which does not
work on remote projects via tramp.
---
ggtags.el | 45 +++++++++++++++++++++++++++------------------
1 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index e36fbb6..70786a0 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -318,6 +318,9 @@ properly update `ggtags-mode-map'."
"Return non-nil if XS is a list of strings."
(cl-every #'stringp xs))
+(defun ggtags-ensure-localname (file)
+ (and file (or (file-remote-p file 'localname) file)))
+
(defun ggtags-echo (format-string &rest args)
"Print formatted text to echo area."
(let (message-log-max) (apply #'message format-string args)))
@@ -550,7 +553,8 @@ Value is new modtime if updated."
(root (make-symbol "-ggtags-project-root-")))
`(let* ((,root ggtags-project-root)
(,gtagsroot (when (ggtags-find-project)
- (directory-file-name (ggtags-current-project-root))))
+ (ggtags-ensure-localname
+ (directory-file-name
(ggtags-current-project-root)))))
(process-environment
(append (let ((process-environment process-environment))
(and ,gtagsroot (setenv "GTAGSROOT" ,gtagsroot))
@@ -579,28 +583,33 @@ source trees. See Info node `(global)gtags' for details."
(interactive "DRoot directory: ")
(let ((process-environment process-environment))
(when (zerop (length root)) (error "No root directory provided"))
- (setenv "GTAGSROOT" (expand-file-name
- (directory-file-name (file-name-as-directory root))))
+ (setenv "GTAGSROOT" (ggtags-ensure-localname
+ (expand-file-name
+ (directory-file-name (file-name-as-directory
root)))))
(ggtags-with-current-project
(let ((conf (and ggtags-use-project-gtagsconf
(cl-loop for name in '(".globalrc" "gtags.conf")
for full = (expand-file-name name root)
thereis (and (file-exists-p full) full)))))
- (cond (conf (setenv "GTAGSCONF" conf))
- ((and (not (getenv "GTAGSLABEL"))
- (yes-or-no-p "Use `ctags' backend? "))
- (setenv "GTAGSLABEL" "ctags"))))
- (with-temp-message "`gtags' in progress..."
- (let ((default-directory (file-name-as-directory root)))
- (condition-case err
- (apply #'ggtags-process-string
- "gtags" (and ggtags-use-idutils '("--idutils")))
- (error (if (and ggtags-use-idutils
- (stringp (cadr err))
- (string-match-p "mkid not found" (cadr err)))
- ;; Retry without mkid
- (ggtags-process-string "gtags")
- (signal (car err) (cdr err))))))))
+ (unless (or conf (getenv "GTAGSLABEL")
+ (not (yes-or-no-p "Use `ctags' backend? ")))
+ (setenv "GTAGSLABEL" "ctags"))
+ (with-temp-message "`gtags' in progress..."
+ (let ((default-directory (file-name-as-directory root))
+ (args (cl-remove-if
+ ;; Place --idutils first
+ #'null (list (and ggtags-use-idutils "--idutils")
+ (and conf "--gtagsconf")
+ (and conf (ggtags-ensure-localname
conf))))))
+ (condition-case err
+ (apply #'ggtags-process-string "gtags" args)
+ (error (if (and ggtags-use-idutils
+ (stringp (cadr err))
+ (string-match-p "mkid not found" (cadr err)))
+ ;; Retry without mkid
+ (apply #'ggtags-process-string
+ "gtags" (cl-remove "--idutils" args))
+ (signal (car err) (cdr err)))))))))
(message "GTAGS generated in `%s'" root)
root))
- [elpa] 04/18: Add NEWS to README.rst for 0.8.0 and 0.8.1, (continued)
- [elpa] 04/18: Add NEWS to README.rst for 0.8.0 and 0.8.1, Leo Liu, 2014/04/04
- [elpa] 02/18: New function ggtags-echo and use it, Leo Liu, 2014/04/04
- [elpa] 01/18: For #45: Fix popping up/down window for search with single match, Leo Liu, 2014/04/04
- [elpa] 03/18: Fix #45: Change default value of ggtags-auto-jump-to-match, Leo Liu, 2014/04/04
- [elpa] 06/18: Fix error in approximation to (line-number-at-pos (point-max)), Leo Liu, 2014/04/04
- [elpa] 05/18: New function ggtags-eldoc-function for eldoc support, Leo Liu, 2014/04/04
- [elpa] 08/18: Don't activate eldoc support by default, Leo Liu, 2014/04/04
- [elpa] 09/18: Fix multiple calls of ggtags-show-definition, Leo Liu, 2014/04/04
- [elpa] 10/18: Make ggtags-eldoc-function work better when no project root, Leo Liu, 2014/04/04
- [elpa] 07/18: Refactor out ggtags-include-file from ggtags-find-tag-dwim, Leo Liu, 2014/04/04
- [elpa] 12/18: Make ggtags-use-project-gtagsconf work on remote projects,
Leo Liu <=
- [elpa] 11/18: Revert "Fix ggtags-with-current-project to include GTAGSCONF", Leo Liu, 2014/04/04
- [elpa] 13/18: New macro ggtags-with-temp-message that reports execution time, Leo Liu, 2014/04/04
- [elpa] 14/18: Don't reply on excution order of filter and sentinel functions, Leo Liu, 2014/04/04
- [elpa] 15/18: Revert "Don't reply on excution order of filter and sentinel functions", Leo Liu, 2014/04/04
- [elpa] 16/18: Properly fix the bug by delaying compilation finish functions, Leo Liu, 2014/04/04
- [elpa] 17/18: Doc fixes and add NEWS for 0.8.2, Leo Liu, 2014/04/04
- [elpa] 18/18: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/04/04