branch: elpa/drupal-mode
commit 808d1f17682fccb807385d1485e0c5a6af0b9f37
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>
Use `eldoc-mode' for function argument tips.
---
drupal-mode.el | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/drupal-mode.el b/drupal-mode.el
index 4c60128b86..87e3fdec6f 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -6,7 +6,7 @@
;; URL: https://github.com/arnested/drupal-mode
;; Created: January 17, 2012
;; Version: 0.2.0
-;; Package-Requires: ((php-mode "1.5.0") (pos-tip "0.4.5"))
+;; Package-Requires: ((php-mode "1.5.0"))
;; Keywords: programming, php, drupal
;; This file is part of Drupal mode.
@@ -35,7 +35,6 @@
(require 'php-mode)
(require 'format-spec)
-(autoload 'pos-tip-show "pos-tip")
@@ -131,11 +130,6 @@ Include path to the executable if it is not in your $PATH."
:link '(variable-link drupal-drush-program)
:group 'drupal-drush)
-(defcustom drupal-show-function-arguments-tooltip-delay 5
- "Show function arguments tooltip after a delay (seconds)."
- :type '(integer)
- :group 'drupal)
-
;;;###autoload
(defcustom drupal-php-modes (list 'php-mode 'web-mode)
"Major modes to consider PHP in Drupal mode."
@@ -244,8 +238,11 @@ function arguments.")
(when (apply 'derived-mode-p drupal-php-modes)
;; Show function arguments from GNU GLOBAL for function at point
;; after a short delay of idle time.
- (when drupal-get-function-args
- (run-with-idle-timer drupal-show-function-arguments-tooltip-delay t
'drupal-get-function-args-at-point))
+ (when (and drupal-get-function-args
+ (fboundp 'eldoc-mode))
+ (set (make-local-variable 'eldoc-documentation-function)
+ 'drupal-eldoc-documentation-function)
+ (eldoc-mode 1))
;; Setup cc-mode style stuff.
(when (derived-mode-p 'c-mode)
@@ -455,16 +452,13 @@ instead."
(search-forward-regexp (concat symbol "(\\(.*\\))") nil t)
(match-string-no-properties 1))))
-(defun drupal-get-function-args-at-point ()
+(defun drupal-eldoc-documentation-function ()
"Show function arguments for function at point."
- (interactive)
(when drupal-get-function-args
(let* ((symbol (php-get-pattern))
- (args (funcall drupal-get-function-args symbol)))
+ (args (when symbol (funcall drupal-get-function-args symbol))))
(when args
- (if (window-system)
- (pos-tip-show (format "%s(%s)" symbol args))
- (message "%s" (format "%s(%s)" symbol args)))))))
+ (message "%s: (%s)" symbol args)))))