Skip to content

Commit 319acd5

Browse files
committed
Moved eldoc stuff to separate file.
1 parent 945ddcc commit 319acd5

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

drupal-mode.el

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,6 @@ function arguments.")
302302

303303
;; Stuff special for php-mode buffers.
304304
(when (apply 'derived-mode-p drupal-php-modes)
305-
;; Show function arguments from GNU GLOBAL for function at point
306-
;; after a short delay of idle time.
307-
(when (and drupal-get-function-args
308-
(fboundp 'eldoc-mode))
309-
(set (make-local-variable 'eldoc-documentation-function)
310-
#'drupal-eldoc-documentation-function)
311-
(eldoc-mode 1))
312-
313305
;; Set correct comment style for inline comments.
314306
(setq comment-start "//")
315307
(setq comment-padding " ")
@@ -877,6 +869,7 @@ mode-hook."
877869

878870
;; Load support for various Emacs features if necessary.
879871
(eval-after-load 'autoinsert '(require 'drupal/autoinsert))
872+
(eval-after-load 'eldoc '(require 'drupal/eldoc))
880873
(eval-after-load 'etags '(require 'drupal/etags))
881874
(eval-after-load 'gtags '(require 'drupal/gtags))
882875
(eval-after-load 'ggtags '(require 'drupal/ggtags))

drupal/eldoc.el

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
;;; drupal/eldoc.el --- Drupal-mode support for eldoc.el
2+
3+
;; Copyright (C) 2015 Arne Jørgensen
4+
5+
;; Author: Arne Jørgensen <[email protected]>
6+
7+
;; This file is part of Drupal mode.
8+
9+
;; Drupal mode is free software; you can redistribute it and/or modify
10+
;; it under the terms of the GNU General Public License as published
11+
;; by the Free Software Foundation, either version 3 of the License,
12+
;; or (at your option) any later version.
13+
14+
;; Drupal mode is distributed in the hope that it will be useful, but
15+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
16+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
;; General Public License for more details.
18+
19+
;; You should have received a copy of the GNU General Public License
20+
;; along with Drupal mode. If not, see <http://www.gnu.org/licenses/>.
21+
22+
;;; Commentary:
23+
24+
;; Enable drupal-mode support for eldoc.
25+
26+
;;; Code:
27+
28+
(defun drupal/eldoc-enable ()
29+
"Enable eldoc in PHP files."
30+
(when (apply 'derived-mode-p drupal-php-modes)
31+
;; Show function arguments from GNU GLOBAL for function at point
32+
;; after a short delay of idle time.
33+
(when (fboundp 'eldoc-mode)
34+
(set (make-local-variable 'eldoc-documentation-function)
35+
#'drupal-eldoc-documentation-function)
36+
(eldoc-mode 1))))
37+
38+
(add-hook 'drupal-mode-hook #'drupal/eldoc-enable)
39+
40+
(when drupal-mode
41+
(drupal/eldoc-enable))
42+
43+
44+
45+
(provide 'drupal/eldoc)
46+
47+
;;; drupal/eldoc.el ends here

0 commit comments

Comments
 (0)