【发布时间】:2012-09-28 16:02:36
【问题描述】:
情况如下:我需要检索点边界下的人脸,但如果我使用高亮当前行模式,该人脸会覆盖我感兴趣的人脸。
face-at-point 或 (get-char-property (point) 'face) 只会给我列表中的第一张面孔,它将是当前行覆盖中的面孔。如何获取底层人脸?
编辑:
这或多或少是我最终做的:
(defun haxe-face-at-point ()
"This is like `face-at-point' except we will only look for faces
which are relevant to haxe-mode. This will also look under overlays
created by minor modes like ispel or highlight current line."
(interactive)
(let ((props (text-properties-at (point))))
(catch 't
(while props
(when (eql (car props) 'face)
(throw 't
(when (member (cadr props)
'(font-lock-string-face
font-lock-keyword-face
font-lock-variable-name-face
font-lock-comment-face
font-lock-preprocessor-face
font-lock-type-face
default))
(cadr props))))
(setq props (cdr props))))))
我只需要找出是否有列表中的一个。
【问题讨论】:
标签: emacs elisp overlay emacs-faces