From 089fe56079fc1e58d9db553eb56cfe883f18ec73 Mon Sep 17 00:00:00 2001 From: Gerry Agbobada Date: Sat, 15 Aug 2020 11:38:38 +0200 Subject: [PATCH] Use simpler method to highlight nbsp If it does not work on non-X builds we will fall back to the ergodis method based on adding a font-lock class --- modules/input/layout/+bepo.el | 5 +++++ modules/input/layout/autoload/bepo.el | 10 ---------- modules/input/layout/config.el | 5 ----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/modules/input/layout/+bepo.el b/modules/input/layout/+bepo.el index eff9d76d8..ef6197acf 100644 --- a/modules/input/layout/+bepo.el +++ b/modules/input/layout/+bepo.el @@ -8,6 +8,11 @@ (doom-bepo-rotate-collection-keymaps-h-builder doom-bepo-cr-rotation-style)) (add-hook 'evil-collection-setup-hook #'doom-bepo--evil-collection-hook) +;; Highlight non breaking spaces as error in prog modes only +;; TODO: this variable is defined in a file called xdisp.c Will that work in non-X builds ? +(setq nobreak-char-display t) +(set-face-attribute 'nobreak-space nil :underline t) + (add-transient-hook! 'doom-init-modules-hook (setq avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n) lispy-avy-keys '(?a ?u ?i ?e ?, ?c ?t ?s ?r ?n ?m ?b ?é ?p ?o ?è ?v ?d ?l ?j ?z)) diff --git a/modules/input/layout/autoload/bepo.el b/modules/input/layout/autoload/bepo.el index ce434a097..83ba06287 100644 --- a/modules/input/layout/autoload/bepo.el +++ b/modules/input/layout/autoload/bepo.el @@ -1,15 +1,5 @@ ;;; input/keymaps/autoload/bepo.el -*- lexical-binding: t; -*- -;;;###autoload -(defun doom-bepo-highlight-hard-spaces () - "Highlight hard (non-breaking) space characters (`?\u00a0'). -\(This is also ?\240.) -This also sets `nobreak-char-display' to nil, to turn off its -low-level, vanilla highlighting." - (interactive) - (when (boundp 'nobreak-char-display) (setq nobreak-char-display nil)) - (font-lock-add-keywords nil `(("[\u00a0]+" (0 'doom-bepo-hard-space 'prepend))) 'APPEND)) - ;;;###autoload (defun doom-bepo-rotate-ts-bare-keymap (keymaps) "Rotate [jk] with [ts] in KEYMAP." diff --git a/modules/input/layout/config.el b/modules/input/layout/config.el index 64ba80d2d..2e8d667dd 100644 --- a/modules/input/layout/config.el +++ b/modules/input/layout/config.el @@ -1,10 +1,5 @@ ;;; input/keymaps/config.el -*- lexical-binding: t; -*- -(defface doom-bepo-hard-space '((t (:background "Aquamarine"))) - "*Face for highlighting non-breaking spaces (`?\u00a0')in Font-Lock mode. -\(This is also ?\240.)" - :group 'doom-bepo :group 'faces) - (defvar doom-bepo-cr-rotation-style 'ergodis "Modify this variable in your $DOOMDIR/init.el Style of binding rotation for the cr keys.