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

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

Re: display zero with space U+200B


From: Pascal J. Bourguignon
Subject: Re: display zero with space U+200B
Date: Wed, 08 Dec 2010 15:27:59 -0000
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux)

Florian Kaufmann <sensorflo@gmail.com> writes:

> I have a file containing zero with space characters (unicode code
> point U+200B). Any idea how I can get a visual feedback where they
> are? I tried to customize whitespace-display-mappings of whitespace.el
> like this:
>
> (defcustom whitespace-display-mappings '( (space-mark ?\x200B [?\xB7]
> [?.]) ...
>
> But I still don't see it. Normal spaces are displayed as intented by
> whitespace.el.

My advice would be to delete them from the file.


Since they have a null width, you cannot see them, obviously.
But you could show the characters that are around them.

(let ((zws ?\u200b))
  (re-search-forward (format "\\(^%c.\\|.%c.\\|.%c$\\|^%c$\\)" zws zws zws 
zws)))



Another way to do it would involve compose-region:

(font-lock-add-keywords nil
  `((,(format "\\(%c\\)" ?\u200b) ; #\ZERO_WIDTH_SPACE
     (1 (progn (compose-region (match-beginning 1) (match-end 1)
                               ?\u2b1b ; #\BLACK_LARGE_SQUARE
                               'decompose-region)
                nil)))))


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

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