[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"
- [elpa] branch master updated (76cd6eb -> 4e171a5), Leo Liu, 2014/06/22
- [elpa] 01/14: Fix #54: New command ggtags-find-tag-mouse, Leo Liu, 2014/06/22
- [elpa] 02/14: Update doc strings and comments, Leo Liu, 2014/06/22
- [elpa] 03/14: Fix #56: Restore variable ggtags-completing-read-function, Leo Liu, 2014/06/22
- [elpa] 05/14: Fix #59: detect missing tag files and remove project cache, Leo Liu, 2014/06/22
- [elpa] 04/14: New command ggtags-find-definition for #57, Leo Liu, 2014/06/22
- [elpa] 06/14: Make ggtags-create-tags invalidate ggtags-project-root, Leo Liu, 2014/06/22
- [elpa] 07/14: Fix #65: Clear ggtags-project-root based on default-directory, Leo Liu, 2014/06/22
- [elpa] 11/14: Fix #58: Search history can be manipulated with C-k and C-y, Leo Liu, 2014/06/22
- [elpa] 08/14: Fix #64: Bind M-s s to ggtags-navigation-isearch-forward, Leo Liu, 2014/06/22
- [elpa] 09/14: Fix #60: Declutter command and highlight tag in search history,
Leo Liu <=
- [elpa] 10/14: Refactoring: Use a major mode for viewing search history, Leo Liu, 2014/06/22
- [elpa] 14/14: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/06/22
- [elpa] 13/14: Fix ggtags-global-handle-exit to conditionally pop up window, Leo Liu, 2014/06/22
- [elpa] 12/14: Replace kill-buffer-and-window with ggtags-kill-window, Leo Liu, 2014/06/22