Move whitespace config to core-ui

Introduces new doom|show-whitespace-maybe hook to replace
doom|editorconfig-whitespace-mode-maybe
This commit is contained in:
Henrik Lissner 2018-05-08 23:21:17 +02:00
parent 317b556bde
commit 67f9aa1ffe
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 26 additions and 10 deletions

View file

@ -36,16 +36,7 @@ modes are active and the buffer is read-only.")
tabify-regexp "^\t* [ \t]+" ; for :retab tabify-regexp "^\t* [ \t]+" ; for :retab
;; Wrapping ;; Wrapping
truncate-lines t truncate-lines t
truncate-partial-width-windows 50 truncate-partial-width-windows 50)
;; whitespace-mode
whitespace-line-column nil
whitespace-style
'(face indentation tabs tab-mark spaces space-mark newline newline-mark
trailing lines-tail)
whitespace-display-mappings
'((tab-mark ?\t [? ?\t])
(newline-mark ?\n [ ?\n])
(space-mark ?\ [] [?.])))
;; ediff ;; ediff
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"

View file

@ -279,6 +279,31 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)) (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function))
(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook) (add-hook 'server-visit-hook 'server-remove-kill-buffer-hook)
;; whitespace-mode settings
(setq whitespace-line-column nil
whitespace-style
'(face indentation tabs tab-mark spaces space-mark newline newline-mark
trailing lines-tail)
whitespace-display-mappings
'((tab-mark ?\t [? ?\t])
(newline-mark ?\n [ ?\n])
(space-mark ?\ [] [?.])))
(defun doom|show-whitespace-maybe ()
"Show whitespace-mode when file has an `indent-tabs-mode' that is different
from the default."
(unless (eq indent-tabs-mode (default-value 'indent-tabs-mode))
(require 'whitespace)
(set (make-local-variable 'whitespace-style)
(if (or (bound-and-true-p whitespace-mode)
(bound-and-true-p whitespace-newline-mode))
(cl-union (if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark))
whitespace-style)
`(face ,@(if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark))
trailing-lines tail)))
(whitespace-mode +1)))
(add-hook 'after-change-major-mode-hook #'doom|show-whitespace-maybe)
;; ;;
;; Custom hooks ;; Custom hooks