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

    Made `drupal-module-name' insert module name when called interactively.
---
 drupal-mode.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index 47c7b798a2..6d5ddbc2ba 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -568,12 +568,16 @@ This will return the best guess at the name of the Drupal 
module
 and encoded suitable for use as function name prefixes.
 
 Used in `drupal-insert-hook' and `drupal-insert-function'."
-  (replace-regexp-in-string "-" "_"
-                            (if drupal-module
-                                drupal-module
-                              ;; Otherwise fall back to a very naive
-                              ;; way of guessing the module name.
-                              (file-name-nondirectory 
(file-name-sans-extension (buffer-file-name))))))
+  (interactive)
+  (let ((name (replace-regexp-in-string "-" "_"
+                                        (if drupal-module
+                                            drupal-module
+                                          ;; Otherwise fall back to a very 
naive
+                                          ;; way of guessing the module name.
+                                          (file-name-nondirectory 
(file-name-sans-extension (buffer-file-name)))))))
+    (if (called-interactively-p)
+        (insert name)
+      name)))
 
 (defun drupal-major-version (&optional version)
   "Return major version number of version string.

Reply via email to