Skip to content

Commit 9a6d362

Browse files
committed
User error if the hook is already inserted elsewhere.
1 parent d09cdf8 commit 9a6d362

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drupal-mode.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,10 @@ buffer."
563563
(when (and (boundp 'imenu--index-alist)
564564
(assoc (replace-regexp-in-string "^hook" (drupal-module-name) v2) (assoc "Named Functions" imenu--index-alist)))
565565
(user-error "%s already exists in file." (replace-regexp-in-string "^hook" (drupal-module-name) v2)))
566+
;; User error if the hook is already inserted elsewhere.
567+
(when (and drupal-get-function-args
568+
(funcall drupal-get-function-args (replace-regexp-in-string "^hook" (drupal-module-name) v2)))
569+
(user-error "%s already exists elsewhere." (replace-regexp-in-string "^hook" (drupal-module-name) v2)))
566570
(drupal-ensure-newline)
567571
"/**\n"
568572
" * Implements " str "().\n"

0 commit comments

Comments
 (0)