emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] non-space, paste, (???) character for inline results


From: Kaushal Modi
Subject: Re: [O] non-space, paste, (???) character for inline results
Date: Wed, 31 Jan 2018 17:52:01 +0000

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 :)

image.png



[1]: https://github.com/kaushalmodi/.emacs.d/blob/d8877836b8566a8831c735a8ec2000133230ad41/setup-files/setup-unicode.el#L40
[2]: https://github.com/kaushalmodi/.emacs.d/blob/d8877836b8566a8831c735a8ec2000133230ad41/setup-files/setup-visual.el#L617-L635
--

Kaushal Modi


reply via email to

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