emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 115194c 2/4: Hook ggtags-eldoc-function to eldoc-documenta


From: Leo Liu
Subject: [elpa] master 115194c 2/4: Hook ggtags-eldoc-function to eldoc-documentation-function
Date: Fri, 16 Jan 2015 13:34:35 +0000

branch: master
commit 115194cc27dd578b986aaaf0dc390bb57e9838b2
Author: Leo Liu <address@hidden>
Commit: Leo Liu <address@hidden>

    Hook ggtags-eldoc-function to eldoc-documentation-function
---
 README.rst |    5 +++--
 ggtags.el  |   12 +++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/README.rst b/README.rst
index 409b09a..a6a69da 100644
--- a/README.rst
+++ b/README.rst
@@ -274,8 +274,8 @@ Integration with other packages
 
 * eldoc
 
-  ``Eldoc`` support can be enabled by, for example, setting this in
-  the desired major mode with:
+  ``Eldoc`` support is set up by default on emacs 24.4+. For older
+  versions set, for example, in the desired major mode:
 
   ::
 
@@ -312,6 +312,7 @@ NEWS
 +++++++++++++
 
 #. ``ggtags-visit-project-root`` can visit past projects.
+#. ``eldoc`` support enabled for emacs 24.4+.
 
 [2014-12-03 Wed] 0.8.8
 ++++++++++++++++++++++
diff --git a/ggtags.el b/ggtags.el
index 9e45a6f..28ce368 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -65,6 +65,9 @@
       (list 'progn (list 'defvar var val docstring)
             (list 'make-variable-buffer-local (list 'quote var)))))
 
+  (or (fboundp 'add-function) (defmacro add-function (&rest _))) ;24.4
+  (or (fboundp 'remove-function) (defmacro remove-function (&rest _)))
+
   (defmacro ignore-errors-unless-debug (&rest body)
     "Ignore all errors while executing BODY unless debug is on."
     (declare (debug t) (indent 0))
@@ -724,7 +727,7 @@ source trees. See Info node `(global)gtags' for details."
   "Update GNU Global tag database.
 Do nothing if GTAGS exceeds the oversize limit unless FORCE.
 
-When called interactively on large (per `ggtags-oversize-limit'
+When called interactively on large (per `ggtags-oversize-limit')
 projects, the update process runs in the background without
 blocking emacs."
   (interactive (progn
@@ -2170,6 +2173,12 @@ 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)
+        ;; Work around http://debbugs.gnu.org/19324
+        (or eldoc-documentation-function
+            (setq-local eldoc-documentation-function #'ignore))
+        (add-function :after-until (local 'eldoc-documentation-function)
+                      #'ggtags-eldoc-function '((name . ggtags-eldoc-function)
+                                                (depth . -100)))
         (unless (memq 'ggtags-mode-line-project-name
                       mode-line-buffer-identification)
           (setq mode-line-buffer-identification
@@ -2177,6 +2186,7 @@ to nil disables displaying this information.")
                         '(ggtags-mode-line-project-name)))))
     (remove-hook 'after-save-hook 'ggtags-after-save-function t)
     (remove-hook 'completion-at-point-functions #'ggtags-completion-at-point t)
+    (remove-function (local 'eldoc-documentation-function) 
'ggtags-eldoc-function)
     (setq mode-line-buffer-identification
           (delq 'ggtags-mode-line-project-name 
mode-line-buffer-identification))
     (and (overlayp ggtags-highlight-tag-overlay)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]