On Wed, Jan 31, 2018 at 12:44 PM Greg Minshall <
address@hidden> wrote:
ah. how does one enter a zero-width space in emacs/org-mode?
By default, you can do C-x 8 RET and type ZERO WIDTH SPACE and the 0x200b character will be inserted.
I use it once in a while, so I have bound it to C-x 8 0 [1].
also, i'm
curious about how it looks on the screen. (for me, i'd want it to look,
on the screen, *very* obvious that *something* is there.)
I have been bit by ZERO WIDTH SPACE characters present in Org buffer and getting wrong fontification.. and so I came up with [2]:
(defun modi/highlight-confusing-chars ()
"Highlight confusing characters in different glyphs + face.
EN DASH -> 2 Hyphens
EM DASH -> 3 Hyphens
ZERO WIDTH SPACE -> ∅
All glyphs are shown in `modi/highlight-confusing' face."
(let* ((glyph-en-dash (make-glyph-code ?- 'modi/highlight-confusing)) ;HYPHEN-MINUS follows that ?
(glyph-em-dash glyph-en-dash) ;HYPHEN-MINUS follows that ?
(glyph-zws (make-glyph-code ?∅ 'modi/highlight-confusing)))
(when (not buffer-display-table)
(setq buffer-display-table (make-display-table)))
(aset buffer-display-table ?– `[,glyph-en-dash ,glyph-en-dash]) ;EN DASH follows that ?
(aset buffer-display-table ?— `[,glyph-em-dash ,glyph-em-dash ,glyph-em-dash]) ;EM DASH follows that ?
(aset buffer-display-table ? `[,glyph-zws])))
(dolist (hook '(prog-mode-hook
org-mode-hook))
(add-hook hook #'modi/highlight-confusing-chars))
It's not evident in the above code, but there' actually a ZERO WIDTH SPACE char after the ? in the third aset form.. and it looks like this (image pasted below) to me :)
