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

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

[elpa] 09/14: Fix #60: Declutter command and highlight tag in search his


From: Leo Liu
Subject: [elpa] 09/14: Fix #60: Declutter command and highlight tag in search history
Date: Sun, 22 Jun 2014 09:41:42 +0000

leoliu pushed a commit to branch master
in repository elpa.

commit 63e557a6b0a0fd5da19ba3862e7d109fc78cc568
Author: Leo Liu <address@hidden>
Date:   Sun Jun 15 10:16:03 2014 +0800

    Fix #60: Declutter command and highlight tag in search history
---
 README.rst |    4 ++++
 ggtags.el  |   32 +++++++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/README.rst b/README.rst
index 1c316ee..03b0da9 100644
--- a/README.rst
+++ b/README.rst
@@ -300,6 +300,10 @@ NEWS
 #. New command ``ggtags-find-tag-mouse`` for mouse support.
 #. New command ``ggtags-find-definition``.
 #. Variable ``ggtags-completing-read-function`` restored.
+#. ``ggtags-navigation-isearch-forward`` can also be invoked using
+   ``M-s s``.
+#. The output buffer from ``ggtags-global-rerun-search`` looks
+   cleaner.
 
 [2014-05-06 Tue] 0.8.4
 ++++++++++++++++++++++
diff --git a/ggtags.el b/ggtags.el
index 3a0a0b6..444d613 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -810,9 +810,9 @@ Do nothing if GTAGS exceeds the oversize limit unless 
FORCE."
                           (and ggtags-global-treat-text "--other")
                           (pcase cmd
                             ((pred stringp) cmd)
-                            (`definition "") ;-d not supported by Global 5.7.1
-                            (`reference "-r")
-                            (`symbol "-s")
+                            (`definition nil) ;-d not supported by Global 5.7.1
+                            (`reference "--reference")
+                            (`symbol "--symbol")
                             (`path "--path")
                             (`grep "--grep")
                             (`idutils "--idutils")))
@@ -1026,13 +1026,21 @@ Global and Emacs."
             (nreverse files))))
     (tags-query-replace from to delimited file-form)))
 
+(defun ggtags-global-normalise-command (cmd)
+  (if (string-match
+       (concat (regexp-quote (ggtags-global-build-command nil)) "\\s-*")
+       cmd)
+      (substring-no-properties cmd (match-end 0))
+    cmd))
+
 (defun ggtags-global-search-id (cmd directory)
-  (sha1 (concat directory (make-string 1 0) cmd)))
+  (sha1 (concat directory (make-string 1 0)
+                (ggtags-global-normalise-command cmd))))
 
 (defun ggtags-global-current-search ()
   ;; CMD DIR ENV LINE TEXT
   (ggtags-ensure-global-buffer
-    (list (car compilation-arguments)
+    (list (ggtags-global-normalise-command (car compilation-arguments))
           default-directory
           ggtags-process-environment
           (line-number-at-pos)
@@ -1047,7 +1055,8 @@ Global and Emacs."
                                 (default-directory dir)
                                 (ggtags-project-root dir)
                                 (ggtags-process-environment env))
-                            (ggtags-global-start cmd dir))
+                            (ggtags-global-start
+                             (ggtags-global-build-command cmd) dir))
        (add-hook 'compilation-finish-functions
                  (lambda (buf _msg)
                    (with-current-buffer buf
@@ -1111,10 +1120,19 @@ Global and Emacs."
     (setq truncate-lines t)
     (cl-labels ((prop (s)
                   (propertize s 'face 'minibuffer-prompt))
+                (prop-tag (cmd)
+                  (with-temp-buffer
+                    (insert cmd)
+                    (forward-sexp -1)
+                    (if (eobp)
+                        cmd
+                      (put-text-property (point) (point-max)
+                                         'face font-lock-constant-face)
+                      (buffer-string))))
                 (pp (data)
                   (pcase data
                     (`(,_id ,cmd ,dir ,_env ,line ,text)
-                     (insert (prop " cmd: ") cmd "\n"
+                     (insert (prop " cmd: ") (prop-tag cmd) "\n"
                              (prop " dir: ") dir "\n"
                              (prop "line: ") (number-to-string line) "\n"
                              (prop "text: ") text "\n"



reply via email to

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