在Emacs的光标下获取字体 [英] Get font face under cursor in Emacs
本文介绍了在Emacs的光标下获取字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在开发自己的自定义颜色主题,如果我可以获得影响光标下文本的字体列表,那将非常有用。
这样可以节省我做Mx自定义面板的麻烦,并查看可用的选项,猜测哪一个影响到
任何想法?
解决方案
您可以使用以下代码定义 what-face
:
(defun what-face(pos)
(interactived)
(let((face(or(get-char-property(pos)'read-face-name)
(get-char-property(pos)'face))))
(如果face(消息Face:%sface)(消息No face at%dpos))))
之后,
code> Mx what-face
将打印发现的脸目前为止。
(感谢 thedz 指向出现 What-face
未内置。)
I've been developing my own custom color theme, and it'd be really useful if I could get a list of font-faces affecting the text under the cursor.
Something like Textmate's show current scope command.
That would save me the trouble of doing M-x customize-face and looking through available options, guessing at which one affects the current word I'm on.
Any ideas?
解决方案
You can define what-face
with this code:
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (pos) 'read-face-name)
(get-char-property (pos) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
After that,
M-x what-face
will print the face found at the current point.
(Thanks to thedz for pointing out that what-face
wasn’t built in.)
这篇关于在Emacs的光标下获取字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文