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

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

Re: how to display a character with a specific glyph and face ?


From: Eli Zaretskii
Subject: Re: how to display a character with a specific glyph and face ?
Date: Thu, 23 Oct 2014 18:44:16 +0300

> Date: Thu, 23 Oct 2014 14:57:43 +0200
> From: "Boiteux Frederic" <fboiteux@prosodie.com>
> 
> (make-face 'nbsp-face)
> (set-face-background 'nbsp-face "LightBlue")
> 
> (require 'disp-table)
> (aset standard-display-table
>       (make-char 'latin-iso8859-1  (- ?\240 128))
>       (vector (+ ?\267 (* 524288 (face-id 'nbsp-face)))))
> 
> It was very helpful when editing text mixing standard and no-break spaces. 
> Now, I use Emacs24 and mainly UTF-8 encoded files/buffers, and I tried to do 
> the same, without success. I tried :
> 
> (aset standard-display-table
>       #xA0 ;; NO-BREAK SPACE
>       (vector (+ #xB7 ;; MIDDLE DOT
>                  (* 524288 (face-id 'nbsp-face)))))
> 
> But it doesn't work as expected : I get an Unicode character not mapped to a 
> glyph (giving a number written in a square), with a red background (!).
> 
> Do you know how I could do this display with Emacs24 ?

Like this:

  (aset standard-display-table
        #xA0 ;; NO-BREAK SPACE
        (vector (make-glyph-code #xb7 'nbsp-face)))

I'm with Stefan wondering why you'd need that.  In addition to what
Stefan points out, I can suggest to take a look at whitespace-mode.




reply via email to

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