bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44236: [PATCH] xdisp: Apply nobreak-char-display also to NARROW NO-B


From: Juri Linkov
Subject: bug#44236: [PATCH] xdisp: Apply nobreak-char-display also to NARROW NO-BREAK SPACE U+202F
Date: Sun, 01 Nov 2020 10:30:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> For a long time my customization contained
>
>   (setq dired-listing-switches "-Alv --block-size='1")
>
> that in Dired buffers displays file sizes using nice space
> as the thousands separator between groups of 3 digit.
>
> But now this clean space between numbers is polluted by visual garbage
> of unrequested highlighted underlines.

For example, gnus-article-mode disables this highlighting
in read-only buffers with:

  ;; Prevent Emacs from displaying non-break space with
  ;; `nobreak-space' face.
  (set (make-local-variable 'nobreak-char-display) nil)

But still in Dired buffers this highlighting is useful to see
bad characters in file names.  Whereas such highlighting makes no sense
in file sizes.

> Using 'C-u C-x =' on the character shows that it's NARROW NO-BREAK SPACE
> with the nobreak-space face on it.

It displays this information with this patch:

diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index ec9a968013..075cb21c21 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -687,7 +687,8 @@ describe-char
                                   (save-excursion (goto-char pos)
                                                   (looking-at-p "[ \t]+$")))
                              'trailing-whitespace)
-                            ((and nobreak-char-display char (eq char '#xa0))
+                            ((and nobreak-char-display char
+                                  (eq (get-char-code-property char 
'general-category) 'Zs))
                              'nobreak-space)
                             ((and nobreak-char-display char
                                  (memq char '(#xad #x2010 #x2011)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]