How to let Emacs display a different character from that actually stored?

别等时光非礼了梦想. 提交于 2019-12-05 04:09:09

One way to do this is to add font lock keywords for the relevant modes, and to use compose-region to display the new glyph in place of the old string:

(font-lock-add-keywords
 'latex-mode `(("\\(\\\\alpha\\)"
                (0 (progn (compose-region (match-beginning 1)
                                          (match-end 1) "α")
                          nil)))))

Please also note that org-mode has a feature of this kind already built-in, not only for links as you mentioned, but also for LaTeX-like entities:

(setq org-pretty-entities t)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!