leoliu pushed a commit to branch master
in repository elpa.
commit f97d58ece0f99b39656b75fefa59921d342460a2
Author: Leo Liu <[email protected]>
Date: Wed Apr 2 09:02:28 2014 +0800
Don't activate eldoc support by default
since it is difficult to enable it without overriding users' settings
for emacs <= 24.3.
---
README.rst | 10 +++++-----
ggtags.el | 20 +-------------------
2 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/README.rst b/README.rst
index 9ea1f97..2e25678 100644
--- a/README.rst
+++ b/README.rst
@@ -249,13 +249,13 @@ Integration with other packages
* eldoc
- If ``eldoc-mode`` is enabled it can use ``ggtags`` to show
- definition. An example configuration:
-
- ::
+ ``Eldoc`` support can be enabled by, for example, setting this in
+ the desired major mode with:
- (add-hook 'ggtags-mode-hook 'eldoc-mode)
+ ::
+ (setq-local eldoc-documentation-function #'ggtags-eldoc-function)
+
* imenu
Emacs major modes usually have excellent support for ``imenu`` so
diff --git a/ggtags.el b/ggtags.el
index dfe7a6e..39f0ff6 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -48,15 +48,6 @@
(require 'tabulated-list) ;preloaded since 24.3
(eval-when-compile
- (unless (fboundp 'add-function) ;24.4
- (defmacro add-function (_where place function)
- `(progn
- (make-local-variable ,(cadr place))
- (set ,(cadr place) ,function))))
- (unless (fboundp 'remove-function) ;24.4
- (defmacro remove-function (place _function)
- `(kill-local-variable ,(cadr place))))
-
(unless (fboundp 'setq-local)
(defmacro setq-local (var val)
(list 'set (list 'make-local-variable (list 'quote var)) val)))
@@ -1853,21 +1844,11 @@ to nil disables displaying this information.")
;; Append to serve as a fallback method.
(add-hook 'completion-at-point-functions
#'ggtags-completion-at-point t t)
- ;; `eldoc-documentation-function-default' is only good for
- ;; `emacs-lisp-mode'.
- (when (and (eq eldoc-documentation-function
- 'eldoc-documentation-function-default)
- (not (derived-mode-p 'emacs-lisp-mode)))
- (setq-local eldoc-documentation-function #'ignore))
- (add-function :after-until (local 'eldoc-documentation-function)
- #'ggtags-eldoc-function)
(unless (memq 'ggtags-mode-line-project-name
mode-line-buffer-identification)
(setq mode-line-buffer-identification
(append mode-line-buffer-identification
'(ggtags-mode-line-project-name)))))
- (remove-function (local 'eldoc-documentation-function)
- #'ggtags-eldoc-function)
(remove-hook 'after-save-hook 'ggtags-after-save-function t)
(remove-hook 'completion-at-point-functions #'ggtags-completion-at-point t)
(setq mode-line-buffer-identification
@@ -1928,6 +1909,7 @@ to nil disables displaying this information.")
(declare-function eldoc-message "eldoc")
(defun ggtags-eldoc-function ()
+ "A function suitable for `eldoc-documentation-function' (which see)."
(pcase (cons (ggtags-tag-at-point) ggtags-eldoc-cache)
(`(nil . ,_) nil)
(`(,_x ,_x) nil)