From 8f426652f04ecab390b73a2624e4779c2743c24a Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 2 Aug 2019 20:33:59 +0200 Subject: [PATCH] Replaced workaround for whitespace-mode with better workaround. --- init.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/init.el b/init.el index dcdfdca..0a3f1a3 100644 --- a/init.el +++ b/init.el @@ -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"))) )