leoliu pushed a commit to branch master in repository elpa. commit 0dc9b57935b1b018a89253bd0a3f42e65dbbbc46 Author: Leo Liu <sdl....@gmail.com> Date: Mon Mar 3 18:09:33 2014 +0800
Give ggtags-show-definition-function full information of the definition candidates. --- ggtags.el | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ggtags.el b/ggtags.el index 542affe..b5dd77f 100644 --- a/ggtags.el +++ b/ggtags.el @@ -185,7 +185,11 @@ If an integer abbreviate only names longer than that number." (defcustom ggtags-show-definition-function #'ggtags-show-definition-default "Function called by `ggtags-show-definition' to show definition. -It is passed a list of definnition candidates." +It is passed a list of definnition candidates of the form: + + (TEXT NAME FILE LINE) + +where TEXT is usually the source line of the definition." :type 'function :group 'ggtags) @@ -1319,7 +1323,7 @@ Invoke CALLBACK in BUFFER with process exit status when finished." (defun ggtags-show-definition-default (defs) (let (message-log-max) - (message "%s" (or (car defs) "[definition not found]")))) + (message "%s" (or (caar defs) "[definition not found]")))) (defun ggtags-show-definition (name) (interactive (list (ggtags-read-tag))) @@ -1329,10 +1333,15 @@ Invoke CALLBACK in BUFFER with process exit status when finished." (show (lambda (_status) (goto-char (point-min)) (funcall fn (loop while (re-search-forward re nil t) - collect (buffer-substring (1+ (match-end 2)) - (line-end-position)))) + collect (list (buffer-substring (1+ (match-end 2)) + (line-end-position)) + name + (match-string 1) + (string-to-number (match-string 2))))) (kill-buffer buffer)))) - (ggtags-global-output (list "global" "--result=grep" name) buffer show 30))) + (ggtags-global-output + (list "global" "--result=grep" "--path-style=absolute" name) + buffer show 100))) (defvar ggtags-mode-prefix-map (let ((m (make-sparse-keymap)))