Skip to content

Commit e4c4c3d

Browse files
committed
`drupal-delete-trailing-whitespace' made local var.
Also move `drupal-delete-trailing-whitespace' and `drupal-convert-line-ending' out of the minor mode so it will not be called everytime the mode is activated.
1 parent bcde707 commit e4c4c3d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drupal-mode.el

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ According to http://drupal.org/coding-standards#indenting."
7272
(const :tag "Never" nil))
7373
:link '(url-link "http://drupal.org/coding-standards#indenting")
7474
:group 'drupal)
75+
(make-variable-buffer-local 'drupal-delete-trailing-whitespace)
7576

7677
;; Where to lookup symbols
7778
(defcustom drupal-search-url "http://api.drupal.org/api/search/%v/%s"
@@ -137,11 +138,7 @@ According to http://drupal.org/coding-standards#indenting."
137138
(drupal-detect-drupal-version)
138139
(when (eq major-mode 'php-mode)
139140
(c-add-language 'drupal-mode 'c-mode)
140-
(c-set-style "drupal"))
141-
142-
;; handle line ending and trailing whitespace
143-
(add-hook 'before-save-hook 'drupal-convert-line-ending)
144-
(add-hook 'before-save-hook 'drupal-delete-trailing-whitespace))
141+
(c-set-style "drupal")))
145142

146143
(define-minor-mode drupal-drush-mode
147144
"Advanced minor mode for Drupal Drush development.\n\n\\{drupal-drush-mode-map}"
@@ -304,6 +301,10 @@ mode-hook, i.e.
304301
(add-to-list 'auto-mode-alist '("\\.\\(module\\|test\\|install\\|theme\\|tpl\\.php\\)$" . php-mode))
305302
(add-to-list 'auto-mode-alist '("\\.info$" . conf-windows-mode)))
306303

304+
;; Handle line ending and trailing white space.
305+
(add-hook 'before-save-hook 'drupal-convert-line-ending)
306+
(add-hook 'before-save-hook 'drupal-delete-trailing-whitespace)
307+
307308
;; Load support for various Emacs features if necessary.
308309
(eval-after-load 'etags '(require 'drupal/etags))
309310

0 commit comments

Comments
 (0)