Replaced workaround for whitespace-mode with better workaround.

This commit is contained in:
tastytea 2019-08-02 20:33:59 +02:00
parent 2c0ed621c2
commit 8f426652f0
1 changed files with 12 additions and 13 deletions

25
init.el
View File

@ -1,5 +1,5 @@
;;; init.el --- tastytea's Emacs init file.
;; Time-stamp: <2019-08-01T18:47:22+00:00>
;; Time-stamp: <2019-08-02T18:33:48+00:00>
;;; Commentary:
;; I am using this file with Emacs 26, but most of it will probably work with
@ -637,8 +637,8 @@ With argument, do this that many times."
;; Visualize whitespace.
(use-package whitespace
:after company
;; :custom
;; (whitespace-line-column nil) ; Set to fill-column.
:custom
(whitespace-line-column nil) ; Set to fill-column.
:config
(delete 'newline-mark whitespace-style) ; Don't paint $ at eol.
(delete 'lines whitespace-style) ; Don't mark whole overly long lines.
@ -683,19 +683,18 @@ With argument, do this that many times."
:underline t
)))))
)
(defun my/ws-load-local-vars-first ()
"Loads local variables (fill-column) before enabling whitespace-mode."
(hack-local-variables)
(whitespace-mode)
)
:bind
("C-x w" . whitespace-mode)
:hook
(prog-mode . whitespace-mode)
(conf-mode . whitespace-mode)
(text-mode . whitespace-mode)
(find-file . (lambda ()
(when (my/whitespace-mode-enabled-p)
(whitespace-mode -1)
(setq-local whitespace-line-column fill-column)
(whitespace-mode t)
)
))
(prog-mode . my/ws-load-local-vars-first)
(conf-mode . my/ws-load-local-vars-first)
(text-mode . my/ws-load-local-vars-first)
:custom-face
(whitespace-space ((nil :foreground "gray18")))
)