Skip to content

Commit 5b5ab1f

Browse files
committed
Merge pull request #58 from arnested/ignore-vendor
Don't trigger drupal-mode in vendor dirs. Closes #57.
2 parents eb21f8a + accf63b commit 5b5ab1f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drupal-mode.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ Include path to the executable if it is not in your $PATH."
170170
:type '(repeat symbol)
171171
:group 'drupal)
172172

173+
;;;###autoload
174+
(defcustom drupal-ignore-paths-regexp "\\(vendor\\|node_modules\\)"
175+
"Don't enable Drupal mode per default in files whose path match this regexp."
176+
:type 'regexp
177+
:group 'drupal)
178+
173179
(defcustom drupal-enable-auto-fill-mode t
174180
"Whether to use `auto-fill-mode' in Drupal PHP buffers.
175181
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
845851
mode-hook."
846852
(when (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes drupal-other-modes))
847853
(drupal-detect-drupal-version)
848-
(when (or drupal-version
849-
(string-match "drush" (or buffer-file-name default-directory)))
854+
(when (and
855+
(or drupal-version
856+
(string-match "drush" (or buffer-file-name default-directory)))
857+
(not (string-match drupal-ignore-paths-regexp (or buffer-file-name default-directory))))
850858
(drupal-mode 1))))
851859

852860
;;;###autoload

0 commit comments

Comments
 (0)