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

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

[elpa] 31/38: Also record ggtags-process-environment in search history


From: Leo Liu
Subject: [elpa] 31/38: Also record ggtags-process-environment in search history
Date: Mon, 24 Mar 2014 09:31:38 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit dbff63ec96754063ab5f678fe399ff5dbc24f087
Author: Leo Liu <address@hidden>
Date:   Fri Mar 21 12:48:31 2014 +0800

    Also record ggtags-process-environment in search history
---
 ggtags.el |   40 +++++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/ggtags.el b/ggtags.el
index a61a62a..9017d4a 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -693,7 +693,8 @@ non-nil."
                    ;; Appeared in emacs 24.4.
                    (fboundp 'display-buffer-no-window))
               (list #'display-buffer-no-window)
-            display-buffer-overriding-action)))
+            display-buffer-overriding-action))
+         (env ggtags-process-environment))
     (setq ggtags-global-start-marker (point-marker))
     (ggtags-navigation-mode +1)
     (setq ggtags-global-exit-status 0
@@ -701,7 +702,10 @@ non-nil."
     (ggtags-update-tags)
     (ggtags-with-current-project
      (setq ggtags-global-last-buffer
-           (compilation-start command 'ggtags-global-mode)))))
+           (compilation-start command 'ggtags-global-mode)))
+    (with-current-buffer ggtags-global-last-buffer
+      (setq-local ggtags-process-environment env))
+    ggtags-global-last-buffer))
 
 (defun ggtags-find-tag-continue ()
   (interactive)
@@ -843,13 +847,24 @@ Global and Emacs."
 (defun ggtags-global-search-id (cmd directory)
   (sha1 (concat directory (make-string 1 0) cmd)))
 
+(defun ggtags-global-current-search ()
+  ;; CMD DIR ENV LINE TEXT
+  (ggtags-ensure-global-buffer
+    (list (car compilation-arguments)
+          default-directory
+          ggtags-process-environment
+          (line-number-at-pos)
+          (buffer-substring-no-properties
+           (line-beginning-position) (line-end-position)))))
+
 (defun ggtags-global-rerun-search-1 (data)
   (pcase data
-    (`(,cmd ,dir ,line ,_text)
+    (`(,cmd ,dir ,env ,line ,_text)
      (with-current-buffer (let ((ggtags-auto-jump-to-first-match nil)
                                 ;; Switch current project to DIR.
                                 (default-directory dir)
-                                (ggtags-project-root dir))
+                                (ggtags-project-root dir)
+                                (ggtags-process-environment env))
                             (ggtags-global-start cmd dir))
        (add-hook 'compilation-finish-functions
                  (lambda (buf _msg)
@@ -909,7 +924,7 @@ Global and Emacs."
     (cl-labels ((prop (s) (propertize s 'face 'minibuffer-prompt))
                 (pp (data)
                     (pcase data
-                      (`(,_id ,cmd ,dir ,line ,text)
+                      (`(,_id ,cmd ,dir ,_env ,line ,text)
                        (insert (prop " cmd: ") cmd "\n"
                                (prop " dir: ") dir "\n"
                                (prop "line: ") (number-to-string line) "\n"
@@ -934,14 +949,12 @@ Use \\[jump-to-register] to restore the search session."
   (ggtags-ensure-global-buffer
     (cl-labels ((prn (data)
                      (pcase data
-                       (`(,command ,root ,line ,_)
+                       (`(,command ,root ,_env ,line ,_)
                         (princ (format "a ggtags search session `%s' in 
directory `%s' at line %d."
                                        command root line))))))
-      (set-register r (registerv-make
-                       (list (car compilation-arguments) default-directory
-                             (line-number-at-pos) "")
-                       :jump-func #'ggtags-global-rerun-search-1
-                       :print-func #'prn)))))
+      (set-register r (registerv-make (ggtags-global-current-search)
+                                      :jump-func #'ggtags-global-rerun-search-1
+                                      :print-func #'prn)))))
 
 (defun ggtags-delete-tag-files ()
   "Delete the tag files generated by gtags."
@@ -1448,10 +1461,7 @@ Use \\[jump-to-register] to restore the search session."
         (setq ggtags-global-search-history
               (cl-remove id ggtags-global-search-history :test #'equal :key 
#'car))
         (add-to-history 'ggtags-global-search-history
-                        (list id (car compilation-arguments) default-directory
-                              (line-number-at-pos)
-                              (buffer-substring-no-properties
-                               (line-beginning-position) 
(line-end-position)))))))
+                        (cons id (ggtags-global-current-search))))))
   (run-hooks 'ggtags-find-tag-hook))
 
 (define-minor-mode ggtags-navigation-mode nil



reply via email to

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