我有这个函数来可视化隐藏的“︁”(0xfe01)字符。这可以变得更通用,以便字符串中的所有隐藏字符都可以可视化吗?
(defun my-display-hidden (&optional remove)
"Show/hide the hidden '︁' (0xfe01) characters."
(interactive "P")
(if remove (remove-overlays)
(save-excursion
(goto-char (point-min))
(while (search-forward "︁" nil t) ; (0xfe01)
(let ((ov (make-overlay (match-beginning 0) (match-end 0))))
(overlay-put ov 'display
(buttonize "(0xfe01)"
(let ((pos (match-beginning 0)))
(lambda (_) (describe-char pos)))))
(overlay-put ov 'face 'font-lock-warning-face))))))
该函数可以扩展为以与以下类似的方式显示非 ASCII、零宽度字符。