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

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

[nongnu] elpa/drupal-mode 00aae1e5e8 070/308: Added support for `web-mod


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 00aae1e5e8 070/308: Added support for `web-mode'.
Date: Tue, 25 Jan 2022 10:59:30 -0500 (EST)

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

    Added support for `web-mode'.
    
    If `web-mode' (http://fxbois.free.fr/lisp/web-mode.html) is
    (auto)loaded support it as one of `drupal-php-modes'.
    
    Use `web-mode' for .tpl.php files.
    
    Make sure `drupal-mode' on PHP files only uses cc-mode stuff in major
    modes derived from `c-mode' (`php-mode' is derived; `web-mode' is
    not).
---
 drupal-mode.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index d076b0ba09..2f070f0208 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -131,7 +131,7 @@ Include path to the executable if it is not in your $PATH."
   :group 'drupal-drush)
 
 ;;;###autoload
-(defcustom drupal-php-modes (list 'php-mode)
+(defcustom drupal-php-modes (list 'php-mode 'web-mode)
   "Major modes to consider PHP in Drupal mode."
   :type '(repeat symbol)
   :group 'drupal)
@@ -218,8 +218,9 @@ Include path to the executable if it is not in your $PATH."
 
   ;; Stuff special for php-mode buffers.
   (when (apply 'derived-mode-p drupal-php-modes)
-    (c-add-language 'drupal-mode 'c-mode)
-    (c-set-style "drupal")))
+    (when (derived-mode-p 'c-mode)
+      (c-add-language 'drupal-mode 'c-mode)
+      (c-set-style "drupal"))))
 
 ;;;###autoload
 (define-minor-mode drupal-drush-mode
@@ -564,8 +565,11 @@ mode-hook."
 
 ;;;###autoload
 (progn
-  (add-to-list 'auto-mode-alist 
'("\\.\\(module\\|test\\|install\\|theme\\|tpl\\.php\\)$" . php-mode))
-  (add-to-list 'auto-mode-alist '("\\.info$" . conf-windows-mode)))
+  (add-to-list 'auto-mode-alist 
'("\\.\\(module\\|test\\|install\\|theme\\)\\'" . php-mode))
+  (add-to-list 'auto-mode-alist '("\\.info\\'" . conf-windows-mode))
+  (when (fboundp 'web-mode)
+    (require 'php-mode)
+    (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))))
 
 
 ;; Load support for various Emacs features if necessary.



reply via email to

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