Skip to content

Commit 11bfbda

Browse files
committed
Added drupal-mode to dired buffers.
1 parent 0cb4bca commit 11bfbda

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drupal-mode.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ Include path to the executable if it is not in your $PATH."
164164
:type '(repeat symbol)
165165
:group 'drupal)
166166

167+
;;;###autoload
168+
(defcustom drupal-other-modes (list 'dired-mode)
169+
"Other major modes that should enable Drupal mode."
170+
:type '(repeat symbol)
171+
:group 'drupal)
172+
167173
(defcustom drupal-enable-auto-fill-mode t
168174
"Whether to use `auto-fill-mode' in Drupal PHP buffers.
169175
Drupal mode will only do auto fill in comments (auto filling code
@@ -727,7 +733,7 @@ the location of DRUPAL_ROOT."
727733
(defun drupal-hack-local-variables ()
728734
"Drupal hack `drupal-local-variables' as buffer local variables."
729735
(interactive)
730-
(let ((dir (expand-file-name (or (file-name-directory buffer-file-name) default-directory)))
736+
(let ((dir (expand-file-name (file-name-directory (or buffer-file-name default-directory))))
731737
matches)
732738
(maphash (lambda (key value)
733739
(when (string-match (concat "^" (regexp-quote key)) dir)
@@ -833,14 +839,14 @@ is a mode supported by `drupal-mode' (currently only
833839
834840
The function is suitable for adding to the supported major modes
835841
mode-hook."
836-
(when (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes))
842+
(when (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes drupal-other-modes))
837843
(drupal-detect-drupal-version)
838844
(when (or drupal-version
839845
(string-match "drush" (or buffer-file-name default-directory)))
840846
(drupal-mode 1))))
841847

842848
;;;###autoload
843-
(dolist (mode (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes))
849+
(dolist (mode (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes drupal-other-modes))
844850
(when (intern (concat (symbol-name mode) "-hook"))
845851
(add-hook (intern (concat (symbol-name mode) "-hook")) #'drupal-mode-bootstrap)))
846852

0 commit comments

Comments
 (0)