[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 04/38: Combine ggtags-global-column and tag name search
From: |
Leo Liu |
Subject: |
[elpa] 04/38: Combine ggtags-global-column and tag name search |
Date: |
Mon, 24 Mar 2014 09:31:32 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit f1433826604516b6f759d37b0e8fd2d8aa29ce8e
Author: Leo Liu <address@hidden>
Date: Tue Mar 4 09:13:48 2014 +0800
Combine ggtags-global-column and tag name search
Cannot rely on ggtags-global-column entirely because the source text
may or may not include the whole source line depending on plugin and
output format. See discussion
http://thread.gmane.org/gmane.comp.gnu.global.bugs/1675
---
ggtags.el | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index a01e286..a68347e 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -940,7 +940,6 @@ Global and Emacs."
(defun ggtags-global-column (start)
;; START is the beginning position of source text.
(when-let (mbeg (text-property-any start (line-end-position) 'global-color
t))
- (setq ggtags-current-tag-name nil)
(- mbeg start)))
;;; NOTE: Must not match the 'Global started at Mon Jun 3 10:24:13'
@@ -1144,15 +1143,22 @@ Global and Emacs."
(defun ggtags-move-to-tag (&optional name)
"Move to NAME tag in current line."
- (let ((orig (point))
- (tag (or name ggtags-current-tag-name)))
- (beginning-of-line)
- (if (and tag (re-search-forward
- (concat "\\_<" (regexp-quote tag) "\\_>")
- (line-end-position)
- t))
- (goto-char (match-beginning 0))
- (goto-char orig))))
+ (let ((tag (or name ggtags-current-tag-name)))
+ ;; Do nothing if on the tag already i.e. by `ggtags-global-column'.
+ (unless (or (not tag) (looking-at (concat (regexp-quote tag) "\\_>")))
+ (let ((orig (point))
+ (regexps (mapcar (lambda (fmtstr)
+ (format fmtstr (regexp-quote tag)))
+ '("\\_<%s\\_>" "%s\\_>" "%s"))))
+ (beginning-of-line)
+ (if (loop for re in regexps
+ ;; Note: tag might not agree with current
+ ;; major-mode's symbol, so try harder. For
+ ;; example, in `php-mode' $cacheBackend is
+ ;; a symbol, but cacheBackend is a tag.
+ thereis (re-search-forward re (line-end-position) t))
+ (goto-char (match-beginning 0))
+ (goto-char orig))))))
(defun ggtags-navigation-mode-cleanup (&optional buf time)
(let ((buf (or buf ggtags-global-last-buffer)))
- [elpa] branch master updated (0601efd -> f11199d), Leo Liu, 2014/03/24
- [elpa] 02/38: Give ggtags-show-definition-function full information, Leo Liu, 2014/03/24
- [elpa] 01/38: New command ggtags-show-definition, Leo Liu, 2014/03/24
- [elpa] 08/38: Call ggtags-show-definition-function in the original buffer, Leo Liu, 2014/03/24
- [elpa] 03/38: Don't display buffer if ggtags-navigation-mode is exited, Leo Liu, 2014/03/24
- [elpa] 07/38: Fix some errors in ggtags-global-output, Leo Liu, 2014/03/24
- [elpa] 04/38: Combine ggtags-global-column and tag name search,
Leo Liu <=
- [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