leoliu pushed a commit to branch master in repository elpa. commit 8f3bd01d82f916b03227f1bbe3683be39b62280f Author: Leo Liu <sdl....@gmail.com> Date: Thu Apr 3 08:24:50 2014 +0800
Make ggtags-eldoc-function work better when no project root Make M-. on #include line also triggers indexing project if not already. --- ggtags.el | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ggtags.el b/ggtags.el index 8c97c49..fb9627d 100644 --- a/ggtags.el +++ b/ggtags.el @@ -778,6 +778,7 @@ When called interactively with a prefix arg, always find definition tags." (interactive (let ((include (and (not current-prefix-arg) (ggtags-include-file)))) + (ggtags-ensure-project) (if include (list include 'include) (list (ggtags-read-tag 'definition current-prefix-arg) (and current-prefix-arg 'definition))))) @@ -1920,13 +1921,16 @@ to nil disables displaying this information.") (`nil nil) (tag (if (equal tag (car ggtags-eldoc-cache)) (cadr ggtags-eldoc-cache) - (setq ggtags-eldoc-cache (list tag)) ;don't come back until done - (let* ((ggtags-print-definition-function - (lambda (s) - (setq ggtags-eldoc-cache (list tag s)) - (eldoc-message s)))) - (ggtags-show-definition tag) - nil))))) + (and ggtags-project-root (ggtags-find-project) + (let* ((ggtags-print-definition-function + (lambda (s) + (setq ggtags-eldoc-cache (list tag s)) + (eldoc-message s)))) + ;; Prevent multiple runs of ggtags-show-definition + ;; for the same tag. + (setq ggtags-eldoc-cache (list tag)) + (ggtags-show-definition tag) + nil)))))) ;;; imenu