emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/drupal-mode d09cdf8781 236/308: User error if the hook is


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode d09cdf8781 236/308: User error if the hook is already inserted in the file.
Date: Tue, 25 Jan 2022 10:59:50 -0500 (EST)

branch: elpa/drupal-mode
commit d09cdf87816638bde3c2476977cfe810db9325f4
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    User error if the hook is already inserted in the file.
    
    Fixes #22.
---
 drupal-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index 132e3d7364..5185385965 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -1,6 +1,6 @@
 ;;; drupal-mode.el --- Advanced minor mode for Drupal development
 
-;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014, 2015 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 ;; URL: https://github.com/arnested/drupal-mode
@@ -559,6 +559,10 @@ buffer."
                                        (concat "Implements " hook "(): ") 
(drupal-next-update-id)))
                       (replace-regexp-in-string (regexp-quote 
update-id-placeholder) (number-to-string update-id) hook t))
                   hook))))
+  ;; User error if the hook is already inserted in the file.
+  (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)))
   (drupal-ensure-newline)
   "/**\n"
   " * Implements " str "().\n"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]