Ultra Edit 中可以高亮显示当前的编辑行,Emacs 自带 的 hl-line-mode 也可以实现这个功能。
配置方法如下:
(require 'hl-line) (hl-line-mode 1) ;; or ;; (global-hl-line-mode 1)
自带的高亮配色颜色是固定的,不能和所有的配色方案协 调一致。用下面的办法可以让高亮的颜色自动和当前的配 色方案配合。
(require 'hl-line) ;;(hl-line-mode -1) ;;(global-hl-line-mode -1) ;; for hight line mode (or (facep 'my-hl-line-face) (make-face 'my-hl-line-face)) (setq hl-line-face 'my-hl-line-face) (face-spec-set 'my-hl-line-face '((t ( :background "DodgerBlue3" ;;:bold ;;:weight nil :inverse-video nil )))) (defun wcy-color-theme-adjust-hl-mode-face() "interactive" (let* ((color (x-color-values (face-attribute 'default :background)))) (if (null color) (error "not support.") (let ((my-color (mapcar (lambda (x) (let ((y (/ #XFFFF 4)) (delta #X18FF)) (cond ((< x (* y 1)) (+ x delta)) ((< x (* y 2)) (+ x delta)) ((< x (* y 3)) (- x delta)) (t (- x delta))))) color))) (message "%S %S" color my-color) (set-face-attribute 'my-hl-line-face nil :background (concat "#" (mapconcat (lambda (c) (format "%04X" c)) my-color ""))))))) (wcy-color-theme-adjust-hl-mode-face)
每次改变背景颜色的时候,只要 M-x wcy-color-theme-adjust-hl-mode-face 就可以了. 如果觉得对比不强烈,可以调整
当前行的背景颜色,自动比默认的背景颜色浅一点点,看起来就很舒服了。 不用反差那么大,否则反差太大也很难看。
list-faces-display 可以显示所有的 face 的信息。
describe-face 可以显示某一个 face 的详细信息。