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

25
init.el
View File

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