Advertisement
brokencog

defvar-issue

Apr 24th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.58 KB | None | 0 0
  1. (defvar hcz-set-cursor-color-color "")
  2. (defvar hcz-set-cursor-color-buffer "")
  3. (defun hcz-set-cursor-color-according-to-mode ()
  4.   "change cursor color based on minor mode."
  5.   (let ((color
  6.      (if buffer-read-only "grey"
  7.        (if overwrite-mode "red"
  8.          "orange"))))
  9.     (unless (and
  10.          (string= color hcz-set-cursor-color-color)
  11.          (string= (buffer-name) hcz-set-cursor-color-buffer))
  12.       (set-cursor-color (setq hcz-set-cursor-color-color color))
  13.       (setq hcz-set-cursor-color-buffer (buffer-name)))))
  14. (add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement