unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: how to display a character with a specific glyph and face ?
Date: Thu, 23 Oct 2014 18:44:16 +0300	[thread overview]
Message-ID: <83y4s67pv3.fsf@gnu.org> (raw)
In-Reply-To: <B8F3375A902A0648BD5D9A5ADDE687B0046EEF85@cadine.france.prosodie.local>

> 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	other threads:[~2014-10-23 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 12:57 how to display a character with a specific glyph and face ? Boiteux Frederic
2014-10-23 15:44 ` Eli Zaretskii [this message]
     [not found] <mailman.11860.1414070397.1147.help-gnu-emacs@gnu.org>
2014-10-23 13:30 ` Stefan Monnier
2014-10-24  6:14   ` Boiteux Frederic
2014-10-24  7:02     ` Eli Zaretskii
     [not found]     ` <<837fzq6jbw.fsf@gnu.org>
2014-10-24 14:01       ` Drew Adams
2014-10-24 14:49         ` Boiteux Frederic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y4s67pv3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).