[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 18/38: Fix #36: Allow customising path to global's exectuables
From: |
Leo Liu |
Subject: |
[elpa] 18/38: Fix #36: Allow customising path to global's exectuables |
Date: |
Mon, 24 Mar 2014 09:31:35 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 0f692b80e2265ab523b964a6b1601aae83600b2b
Author: Leo Liu <address@hidden>
Date: Sat Mar 15 15:08:17 2014 +0800
Fix #36: Allow customising path to global's exectuables
---
ggtags.el | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index fa007a9..d7fff8f 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -89,6 +89,12 @@
"Face used to highlight matched line in Global buffer."
:group 'ggtags)
+(defcustom ggtags-executable-directory nil
+ "If non-nil the directory to search global executables."
+ :type '(choice (const :tag "Unset" nil) directory)
+ :risky t
+ :group 'ggtags)
+
(defcustom ggtags-oversize-limit (* 10 1024 1024)
"The over size limit for the GTAGS file.
For large source trees, running 'global -u' can be expensive.
@@ -272,9 +278,15 @@ properly update `ggtags-mode-map'."
(and (stringp (car xs))
(ggtags-list-of-string-p (cdr xs)))))
+(defun ggtags-program-path (name)
+ (if ggtags-executable-directory
+ (expand-file-name name ggtags-executable-directory)
+ name))
+
(defun ggtags-process-string (program &rest args)
(with-temp-buffer
- (let ((exit (apply #'process-file program nil t nil args))
+ (let ((exit (apply #'process-file
+ (ggtags-program-path program) nil t nil args))
(output (progn
(goto-char (point-max))
(skip-chars-backward " \t\n")
@@ -314,13 +326,16 @@ properly update `ggtags-mode-map'."
;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1518
(has-path-style
(with-demoted-errors ; in case `global' not found
- (and (zerop (process-file "global" nil nil nil
+ (and (zerop (process-file (ggtags-program-path "global")
+ nil nil nil
"--path-style" "shorter" "--help"))
'has-path-style)))
;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1542
(has-color
(with-demoted-errors
- (and (zerop (process-file "global" nil nil nil "--color"
"--help"))
+ (and (zerop (process-file (ggtags-program-path "global")
+ nil nil nil
+ "--color" "--help"))
'has-color))))
(puthash default-directory
(ggtags-project--make :root default-directory
@@ -608,7 +623,8 @@ non-nil."
(defun ggtags-global-build-command (cmd &rest args)
;; CMD can be definition, reference, symbol, grep, idutils
- (let ((xs (append (list "global" "-v"
+ (let ((xs (append (list (shell-quote-argument (ggtags-program-path "global"))
+ "-v"
(format "--result=%s" ggtags-global-output-format)
(and ggtags-global-ignore-case "--ignore-case")
(and (ggtags-find-project)
@@ -1326,7 +1342,7 @@ Global and Emacs."
(when (and buffer-file-name
(or ggtags-global-always-update (ggtags-project-oversize-p)))
(ggtags-with-current-project
- (process-file "global" nil 0 nil "--single-update"
+ (process-file (ggtags-program-path "global") nil 0 nil "--single-update"
(file-relative-name buffer-file-name))))))
(defun ggtags-global-output (buffer cmds callback &optional cutoff)
@@ -1384,7 +1400,8 @@ When finished invoke CALLBACK in BUFFER with process exit
status."
(ggtags-with-current-project
(ggtags-global-output
buffer
- (list "global" "--result=grep" "--path-style=absolute" name)
+ (list (ggtags-program-path "global")
+ "--result=grep" "--path-style=absolute" name)
show 100))))
(defvar ggtags-mode-prefix-map
@@ -1591,7 +1608,8 @@ When finished invoke CALLBACK in BUFFER with process exit
status."
(and file (with-temp-buffer
(when (with-demoted-errors
(zerop (ggtags-with-current-project
- (process-file "global" nil t nil "-x" "-f"
file))))
+ (process-file (ggtags-program-path "global")
+ nil t nil "-x" "-f" file))))
(goto-char (point-min))
(cl-loop while (re-search-forward
"^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)" nil t)
- [elpa] 06/38: Fix #34: New variable ggtags-global-always-update, (continued)
- [elpa] 06/38: Fix #34: New variable ggtags-global-always-update, Leo Liu, 2014/03/24
- [elpa] 09/38: Replace ignore-errors with condition-case-unless-debug, Leo Liu, 2014/03/24
- [elpa] 10/38: Automatically use GTAGSCONF file at project root, Leo Liu, 2014/03/24
- [elpa] 05/38: Improve completion support for all tag types, Leo Liu, 2014/03/24
- [elpa] 11/38: Make last change acutally work, Leo Liu, 2014/03/24
- [elpa] 12/38: Fix compatibility for locate-dominating-file, Leo Liu, 2014/03/24
- [elpa] 14/38: Display project root directory name on mode-line, Leo Liu, 2014/03/24
- [elpa] 22/38: New command ggtags-navigation-isearch-forward, Leo Liu, 2014/03/24
- [elpa] 17/38: Fix ggtags-with-current-project to include GTAGSCONF, Leo Liu, 2014/03/24
- [elpa] 19/38: Use read-only-mode in ggtags-toggle-project-read-only, Leo Liu, 2014/03/24
- [elpa] 18/38: Fix #36: Allow customising path to global's exectuables,
Leo Liu <=
- [elpa] 20/38: Teach ggtags-find-tag-dwim to detect #include files, Leo Liu, 2014/03/24
- [elpa] 25/38: Fix ggtags-find-project to check on the GTAGS file, Leo Liu, 2014/03/24
- [elpa] 23/38: Simplify ggtags-save-to-register by always re-do the search, Leo Liu, 2014/03/24
- [elpa] 21/38: Add new command ggtags-save-to-register for #37, Leo Liu, 2014/03/24
- [elpa] 16/38: Fix ggtags-show-definition to run in current project, Leo Liu, 2014/03/24
- [elpa] 24/38: Fix thinko in "Don't display buffer if ggtags-navigation-mode is exited", Leo Liu, 2014/03/24
- [elpa] 26/38: New macro ignore-errors-unless-debug and use it, Leo Liu, 2014/03/24
- [elpa] 15/38: Small fixes to last change, Leo Liu, 2014/03/24
- [elpa] 32/38: Bind ggtags-save-to-register in ggtags-global-rerun-search-map, Leo Liu, 2014/03/24
- [elpa] 28/38: New helper ggtags-forward-to-line and use it, Leo Liu, 2014/03/24