summaryrefslogtreecommitdiff
path: root/lisp/whitespace.el
diff options
context:
space:
mode:
authorVinicius Jose Latorre <viniciusjl@ig.com.br>2011-04-30 12:15:07 -0300
committerVinicius Jose Latorre <viniciusjl@ig.com.br>2011-04-30 12:15:07 -0300
commitcb79b8c0517a92f93539db030db694b293fd8706 (patch)
treebcfa6f643cbb42b61c0a185595595c7d62eb028e /lisp/whitespace.el
parent8db90b73941f09a17c41069828c64b91eca790d6 (diff)
downloademacs-cb79b8c0517a92f93539db030db694b293fd8706.tar.gz
keep highlight when switching between major modes on a file.
Diffstat (limited to 'lisp/whitespace.el')
-rw-r--r--lisp/whitespace.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 955c417ee54..f5788eb1ee2 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -5,7 +5,7 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Keywords: data, wp
-;; Version: 13.2
+;; Version: 13.2.1
;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
;; This file is part of GNU Emacs.
@@ -312,6 +312,9 @@
;; Acknowledgements
;; ----------------
;;
+;; Thanks to felix (EmacsWiki) for keeping highlight when switching between
+;; major modes on a file.
+;;
;; Thanks to David Reitter <david.reitter@gmail.com> for suggesting a
;; `whitespace-newline' initialization with low contrast relative to
;; the background color.
@@ -1132,6 +1135,7 @@ See also `whitespace-style', `whitespace-newline' and
(global-whitespace-mode ; global-whitespace-mode on
(save-excursion
(add-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
+ (add-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled)
(dolist (buffer (buffer-list)) ; adjust all local mode
(set-buffer buffer)
(unless whitespace-mode
@@ -1139,6 +1143,7 @@ See also `whitespace-style', `whitespace-newline' and
(t ; global-whitespace-mode off
(save-excursion
(remove-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
+ (remove-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled)
(dolist (buffer (buffer-list)) ; adjust all local mode
(set-buffer buffer)
(unless whitespace-mode