当用 elisp 改变 point 时, hl-line-mode 没有高亮当前行

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.

(defun jump2 ()
  (interactive)
  (while (not (eobp))
    (when (y-or-n-p "move to next two lines?")
      (forward-line 2))))
$ emacs -Q

M-x hl-line-mode RET
M-x jump2 RET

hl-line-mode的实现是在post-command-hook里运行hl-line-highlight。所以你如果函数中间需要高亮,可以自己加一个(hl-line-highlight)

1 个赞