branch: elpa/drupal-mode
commit 5b5ab1fb420b10a726bca43ac75a46530e2658ec
Merge: eb21f8aaac accf63bac1
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>
Merge pull request #58 from arnested/ignore-vendor
Don't trigger drupal-mode in vendor dirs. Closes #57.
---
drupal-mode.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drupal-mode.el b/drupal-mode.el
index a5a6069bf7..132e3d7364 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -170,6 +170,12 @@ Include path to the executable if it is not in your $PATH."
:type '(repeat symbol)
:group 'drupal)
+;;;###autoload
+(defcustom drupal-ignore-paths-regexp "\\(vendor\\|node_modules\\)"
+ "Don't enable Drupal mode per default in files whose path match this regexp."
+ :type 'regexp
+ :group 'drupal)
+
(defcustom drupal-enable-auto-fill-mode t
"Whether to use `auto-fill-mode' in Drupal PHP buffers.
Drupal mode will only do auto fill in comments (auto filling code
@@ -845,8 +851,10 @@ The function is suitable for adding to the supported major
modes
mode-hook."
(when (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes
drupal-js-modes drupal-info-modes drupal-other-modes))
(drupal-detect-drupal-version)
- (when (or drupal-version
- (string-match "drush" (or buffer-file-name default-directory)))
+ (when (and
+ (or drupal-version
+ (string-match "drush" (or buffer-file-name default-directory)))
+ (not (string-match drupal-ignore-paths-regexp (or buffer-file-name
default-directory))))
(drupal-mode 1))))
;;;###autoload