Created
March 22, 2010 03:40
-
-
Save hitode909/339782 to your computer and use it in GitHub Desktop.
cute-cursor.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar cute-cursor-interval 0.05 | |
"*Interval") | |
(defvar cute-cursor-colors '("red" "green" "blue" "yellow" "purple" "magenta" "cyan") | |
"*Colors") | |
(defvar cute-cursor-current-cursor 0 | |
"Current color") | |
(defvar cute-cursor-timer nil | |
"Timer") | |
(defun cute-cursor-toggle-cursor-color () | |
"Toggle cursor color." | |
(progn | |
(set-cursor-color (nth cute-cursor-current-cursor cute-cursor-colors)) | |
(setq cute-cursor-current-cursor (1+ cute-cursor-current-cursor)) | |
(if (>= cute-cursor-current-cursor (length cute-cursor-colors)) | |
(setq cute-cursor-current-cursor 0)) | |
)) | |
(defun cute-cursor (flag) | |
"Start toggling cursor color when flag is true." | |
(if (and flag cute-cursor-timer) | |
(cute-cursor nil)) | |
(if flag | |
(progn | |
(setq cute-cursor-timer (run-with-timer cute-cursor-interval | |
cute-cursor-interval | |
'cute-cursor-toggle-cursor-color)) | |
(blink-cursor-mode 0)) | |
(when cute-cursor-timer | |
(cancel-timer cute-cursor-timer) | |
(setq cute-cursor-timer nil)))) | |
(provide 'cute-cursor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment