如何从覆盖层下获取人脸?

3
这是情况:我需要检索脸部下方的点边界,但如果我使用高亮当前行模式,该面会覆盖我感兴趣的那个面。
使用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))))))

我只需要找出列表中是否有一个。
1个回答

4

很遗憾,Emacs Lisp代码没有提供好的相关功能。我能提供的最好建议是使用 overlays-at 来定位覆盖层,然后通过循环获取结果,使用 overlay-get 查看哪些覆盖层指定了face,最终使用 get-text-property 获取文本属性中指定的face(如果有的话)。显示引擎将这些组合在一起。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接