From 2b94fb15d4e1b54556b98406c5601ffb1a7cb80f Mon Sep 17 00:00:00 2001 From: Jens Luedicke Date: Mon, 22 Sep 2025 17:04:53 +0200 Subject: [PATCH] Add lost trailing whitespace visualization --- lisp/init-editor.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lisp/init-editor.el b/lisp/init-editor.el index 453f504..d17a022 100644 --- a/lisp/init-editor.el +++ b/lisp/init-editor.el @@ -8,6 +8,25 @@ (global-auto-revert-mode t) ;; Electric-pair-mode is replaced by smartparens in init-qol.el +;;; Whitespace handling +;; Show trailing whitespace in programming modes +(add-hook 'prog-mode-hook + (lambda () + (setq show-trailing-whitespace t))) + +;; Also show trailing whitespace in text modes +(add-hook 'text-mode-hook + (lambda () + (setq show-trailing-whitespace t))) + +;; Delete trailing whitespace on save +(add-hook 'before-save-hook 'delete-trailing-whitespace) + +;; Optionally, you can make trailing whitespace more visible +(setq-default show-trailing-whitespace t) +(custom-set-faces + '(trailing-whitespace ((t (:background "red1"))))) + ;;; Shift-Selection Configuration ;; Enable shift-select mode for selecting text with Shift+Arrow keys (setq shift-select-mode t)