From 0cd241275621e28ec45b25b1ec0e64737ff250c8 Mon Sep 17 00:00:00 2001 From: joddie Date: Tue, 25 Aug 2015 14:24:40 -0700 Subject: [PATCH] Avoid "no tags containing" error in hook skeleton The hook implementation skeleton funcalls `drupal-get-function-args` to check whether the new function implementation already exists elsewhere in the project. When the value of this variable is `drupal/etags-get-function-args`, it throws an error for non-existent function names, making it impossible to insert a new implementation. Adding `ignore-errors` around the call fixes this. --- drupal-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drupal-mode.el b/drupal-mode.el index f6c9476..63d3273 100644 --- a/drupal-mode.el +++ b/drupal-mode.el @@ -556,7 +556,8 @@ buffer." (user-error "%s already exists in file." (replace-regexp-in-string "^hook" (drupal-module-name) v2))) ;; User error if the hook is already inserted elsewhere. (when (and drupal-get-function-args - (funcall drupal-get-function-args (replace-regexp-in-string "^hook" (drupal-module-name) v2))) + (ignore-errors + (funcall drupal-get-function-args (replace-regexp-in-string "^hook" (drupal-module-name) v2)))) (user-error "%s already exists elsewhere." (replace-regexp-in-string "^hook" (drupal-module-name) v2))) (drupal-ensure-newline) "/**\n"