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
This commit is contained in:
Gerry Agbobada 2020-08-15 11:38:38 +02:00 committed by Gerry Agbobada
parent 473d41f889
commit 089fe56079
No known key found for this signature in database
GPG key ID: BE26DBAFD866BE34
3 changed files with 5 additions and 15 deletions

View file

@ -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))

View file

@ -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."

View file

@ -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.