diff options
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/whitespace.el | 23 |
2 files changed, 9 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aae880aa8a2..4c111a66335 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-03-19 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * whitespace.el (whitespace-font-lock, whitespace-font-lock-mode): | ||
| 4 | Remove vars. | ||
| 5 | (whitespace-color-on, whitespace-color-off): Use | ||
| 6 | `font-lock-fontify-buffer' (Bug#13817). | ||
| 7 | |||
| 1 | 2013-03-19 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2013-03-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * mouse.el (mouse--down-1-maybe-follows-link): Fix follow-link | 10 | * mouse.el (mouse--down-1-maybe-follows-link): Fix follow-link |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 0346d17954a..c32155f5430 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -1861,12 +1861,6 @@ cleaning up these problems." | |||
| 1861 | ;;;; Internal functions | 1861 | ;;;; Internal functions |
| 1862 | 1862 | ||
| 1863 | 1863 | ||
| 1864 | (defvar whitespace-font-lock-mode nil | ||
| 1865 | "Used to remember whether a buffer had font lock mode on or not.") | ||
| 1866 | |||
| 1867 | (defvar whitespace-font-lock nil | ||
| 1868 | "Used to remember whether a buffer initially had font lock on or not.") | ||
| 1869 | |||
| 1870 | (defvar whitespace-font-lock-keywords nil | 1864 | (defvar whitespace-font-lock-keywords nil |
| 1871 | "Used to save the value `whitespace-color-on' adds to `font-lock-keywords'.") | 1865 | "Used to save the value `whitespace-color-on' adds to `font-lock-keywords'.") |
| 1872 | 1866 | ||
| @@ -2106,8 +2100,6 @@ resultant list will be returned." | |||
| 2106 | ;; prepare local hooks | 2100 | ;; prepare local hooks |
| 2107 | (add-hook 'write-file-functions 'whitespace-write-file-hook nil t) | 2101 | (add-hook 'write-file-functions 'whitespace-write-file-hook nil t) |
| 2108 | ;; create whitespace local buffer environment | 2102 | ;; create whitespace local buffer environment |
| 2109 | (set (make-local-variable 'whitespace-font-lock-mode) nil) | ||
| 2110 | (set (make-local-variable 'whitespace-font-lock) nil) | ||
| 2111 | (set (make-local-variable 'whitespace-font-lock-keywords) nil) | 2103 | (set (make-local-variable 'whitespace-font-lock-keywords) nil) |
| 2112 | (set (make-local-variable 'whitespace-display-table) nil) | 2104 | (set (make-local-variable 'whitespace-display-table) nil) |
| 2113 | (set (make-local-variable 'whitespace-display-table-was-local) nil) | 2105 | (set (make-local-variable 'whitespace-display-table-was-local) nil) |
| @@ -2157,8 +2149,6 @@ resultant list will be returned." | |||
| 2157 | (defun whitespace-color-on () | 2149 | (defun whitespace-color-on () |
| 2158 | "Turn on color visualization." | 2150 | "Turn on color visualization." |
| 2159 | (when (whitespace-style-face-p) | 2151 | (when (whitespace-style-face-p) |
| 2160 | (unless whitespace-font-lock | ||
| 2161 | (setq whitespace-font-lock t)) | ||
| 2162 | ;; save current point and refontify when necessary | 2152 | ;; save current point and refontify when necessary |
| 2163 | (set (make-local-variable 'whitespace-point) | 2153 | (set (make-local-variable 'whitespace-point) |
| 2164 | (point)) | 2154 | (point)) |
| @@ -2172,10 +2162,6 @@ resultant list will be returned." | |||
| 2172 | nil) | 2162 | nil) |
| 2173 | (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) | 2163 | (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) |
| 2174 | (add-hook 'before-change-functions #'whitespace-buffer-changed nil t) | 2164 | (add-hook 'before-change-functions #'whitespace-buffer-changed nil t) |
| 2175 | ;; turn off font lock | ||
| 2176 | (set (make-local-variable 'whitespace-font-lock-mode) | ||
| 2177 | font-lock-mode) | ||
| 2178 | (font-lock-mode 0) | ||
| 2179 | ;; Add whitespace-mode color into font lock. | 2165 | ;; Add whitespace-mode color into font lock. |
| 2180 | (setq | 2166 | (setq |
| 2181 | whitespace-font-lock-keywords | 2167 | whitespace-font-lock-keywords |
| @@ -2257,22 +2243,17 @@ resultant list will be returned." | |||
| 2257 | (whitespace-space-after-tab-regexp 'space))) | 2243 | (whitespace-space-after-tab-regexp 'space))) |
| 2258 | 1 whitespace-space-after-tab t))))) | 2244 | 1 whitespace-space-after-tab t))))) |
| 2259 | (font-lock-add-keywords nil whitespace-font-lock-keywords t) | 2245 | (font-lock-add-keywords nil whitespace-font-lock-keywords t) |
| 2260 | ;; Now turn on font lock and highlight blanks. | 2246 | (font-lock-fontify-buffer))) |
| 2261 | (font-lock-mode 1))) | ||
| 2262 | 2247 | ||
| 2263 | 2248 | ||
| 2264 | (defun whitespace-color-off () | 2249 | (defun whitespace-color-off () |
| 2265 | "Turn off color visualization." | 2250 | "Turn off color visualization." |
| 2266 | ;; turn off font lock | 2251 | ;; turn off font lock |
| 2267 | (when (whitespace-style-face-p) | 2252 | (when (whitespace-style-face-p) |
| 2268 | (font-lock-mode 0) | ||
| 2269 | (remove-hook 'post-command-hook #'whitespace-post-command-hook t) | 2253 | (remove-hook 'post-command-hook #'whitespace-post-command-hook t) |
| 2270 | (remove-hook 'before-change-functions #'whitespace-buffer-changed t) | 2254 | (remove-hook 'before-change-functions #'whitespace-buffer-changed t) |
| 2271 | (when whitespace-font-lock | ||
| 2272 | (setq whitespace-font-lock nil)) | ||
| 2273 | (font-lock-remove-keywords nil whitespace-font-lock-keywords) | 2255 | (font-lock-remove-keywords nil whitespace-font-lock-keywords) |
| 2274 | ;; restore original font lock state | 2256 | (font-lock-fontify-buffer))) |
| 2275 | (font-lock-mode whitespace-font-lock-mode))) | ||
| 2276 | 2257 | ||
| 2277 | 2258 | ||
| 2278 | (defun whitespace-trailing-regexp (limit) | 2259 | (defun whitespace-trailing-regexp (limit) |