branch: elpa/drupal-mode
commit 9a6d3623b91838ac9a0ca123fccea6444e5bd648
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>

    User error if the hook is already inserted elsewhere.
---
 drupal-mode.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drupal-mode.el b/drupal-mode.el
index 5185385965..125027c1e1 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -563,6 +563,10 @@ buffer."
   (when (and (boundp 'imenu--index-alist)
              (assoc (replace-regexp-in-string "^hook" (drupal-module-name) v2) 
(assoc "Named Functions" imenu--index-alist)))
     (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)))
+    (user-error "%s already exists elsewhere." (replace-regexp-in-string 
"^hook" (drupal-module-name) v2)))
   (drupal-ensure-newline)
   "/**\n"
   " * Implements " str "().\n"

Reply via email to