对, text-properties-at确实可以获取正确的内容, 我写了个简单的minor-mode代替了smart-cursor-color:
(defvar rtcc--default-cursor-color nil
"Default cursor color. When picked foreground color is nil, use this.")
(defvar rtcc--last-post-command-position 0
"Holds the cursor position from the last run of post-command-hooks.")
(make-variable-buffer-local 'rtcc--last-post-command-position)
(defgroup real-time-cursor-color nil
"real time cursor group"
:group 'cursor)
(defun rtcc--set-cursor-color ()
"Change cursor color dynamically."
(unless (equal (point) rtcc--last-post-command-position)
(let ((face (cadr (memq 'face (text-properties-at (point))))))
(if face
(set-cursor-color (face-attribute face :foreground))
(set-cursor-color rtcc--default-cursor-color))))
(setq rtcc--last-post-command-position (point)))
(define-minor-mode real-time-cursor-color-mode
"Dynamically changed cursor color at point's color."
:lighter " rtcc"
:global t
:group 'real-time-cursor-color
:require 'real-time-cursor-color
(if real-time-cursor-color-mode
(progn
(setq rtcc--default-cursor-color (face-attribute 'default :foreground))
(add-hook 'post-command-hook 'rtcc--set-cursor-color))
(remove-hook 'post-command-hook 'rtcc--set-cursor-color)))
(provide 'real-time-cursor-color)