emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 10/38: Automatically use GTAGSCONF file at project root


From: Leo Liu
Subject: [elpa] 10/38: Automatically use GTAGSCONF file at project root
Date: Mon, 24 Mar 2014 09:31:33 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit 0a1b6710acf31021b7da34076dbff019a044641d
Author: Leo Liu <address@hidden>
Date:   Thu Mar 6 18:49:55 2014 +0800

    Automatically use GTAGSCONF file at project root
---
 ggtags.el |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ggtags.el b/ggtags.el
index 6eb3ee7..7ba1de2 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -111,6 +111,13 @@ automatically switches to 'global --single-update'."
   :type 'boolean
   :group 'ggtags)
 
+(defcustom ggtags-use-project-gtagsconf t
+  "Non-nil to automatically use GTAGSCONF file at project root.
+File .globalrc and gtags.conf are checked in order."
+  :safe 'booleanp
+  :type 'boolean
+  :group 'ggtags)
+
 (defcustom ggtags-project-duration 600
   "Seconds to keep information of a project in memory."
   :type 'number
@@ -498,9 +505,13 @@ source trees. See Info node `(global)gtags' for details."
     (setenv "GTAGSROOT" (expand-file-name
                          (directory-file-name (file-name-as-directory root))))
     (ggtags-with-current-project
-     (and (not (getenv "GTAGSLABEL"))
-          (yes-or-no-p "Use `ctags' backend? ")
-          (setenv "GTAGSLABEL" "ctags"))
+     (let ((conf (and ggtags-use-project-gtagsconf
+                      (or (and (file-exists-p ".globalrc") ".globalrc")
+                          (and (file-exists-p "gtags.conf") "gtags.conf")))))
+       (cond (conf (setenv "GTAGSCONF" (expand-file-name 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]