branch: elpa/drupal-mode
commit 0b770695f8c82a367f56b208ed6693a7344f5aa6
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>
Fixed `drupal-get-function-args' to fail gracefully.
If no `drupal-get-function-args' function is defined just don't insert
any arguments instead of failing.
Let the functions `drupal-get-function-args' and
`drupal/gtags-get-function-args' ignore errors do they will also fail
gracefully.
---
drupal-mode.el | 13 +++++++------
drupal/gtags.el | 9 +++++----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/drupal-mode.el b/drupal-mode.el
index c0cee4fe58..6e6de21532 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -398,7 +398,7 @@ function arguments.")
"/**\n"
" * Implements " v1 "().\n"
" */\n"
- "function " (replace-regexp-in-string "hook" (drupal-module-name) v1) "("
(funcall drupal-get-function-args v1 (drupal-major-version)) ") {\n"
+ "function " (replace-regexp-in-string "hook" (drupal-module-name) v1) "("
(when drupal-get-function-args (funcall drupal-get-function-args v1
(drupal-major-version))) ") {\n"
" " @ _ "\n"
"}\n")
@@ -434,11 +434,12 @@ instead."
(unless version
(setq version (drupal-detect-drupal-version)))
(with-temp-buffer
- (url-insert-file-contents (format-spec drupal-search-url `((?v . ,version)
- (?s .
,symbol))))
- (search-forward "<tr class=\"active\">" nil t)
- (search-forward-regexp (concat symbol "(\\(.*\\))") nil t)
- (match-string-no-properties 1)))
+ (ignore-errors
+ (url-insert-file-contents (format-spec drupal-search-url `((?v .
,version)
+ (?s .
,symbol))))
+ (search-forward "<tr class=\"active\">" nil t)
+ (search-forward-regexp (concat symbol "(\\(.*\\))") nil t)
+ (match-string-no-properties 1))))
diff --git a/drupal/gtags.el b/drupal/gtags.el
index 96d9ae3e4b..ee14e9cc07 100644
--- a/drupal/gtags.el
+++ b/drupal/gtags.el
@@ -46,10 +46,11 @@
(when (and (boundp 'drupal-rootdir)
(file-exists-p (concat drupal-rootdir "GTAGS")))
(with-temp-buffer
- (call-process gtags-global-command nil t nil "-x" symbol)
- (goto-char (point-min))
- (search-forward-regexp ".*(\\(.*\\)).*" nil t)
- (match-string 1))))
+ (ignore-errors
+ (call-process gtags-global-command nil t nil "-x" symbol)
+ (goto-char (point-min))
+ (search-forward-regexp ".*(\\(.*\\)).*" nil t)
+ (match-string-no-properties 1)))))
(add-hook 'drupal-mode-hook #'drupal/gtags-enable)