Created
April 18, 2012 14:58
-
-
Save syohex/2414124 to your computer and use it in GitHub Desktop.
Emacs u-nya-mode
This file contains hidden or 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
(defgroup u-nya nil | |
"Showing u-nya on mode-line." | |
:prefix "u-nya-" | |
:group 'frames) | |
(defface u-nya:face | |
nil | |
"Face for modeline" | |
:group 'u-nya) | |
(provide 'nyan-mode) | |
(defvar u-nya:pattern | |
'( | |
"(」・ω・)」うー! " | |
"(/・ω・)/にゃー!" | |
"(」・ω・)」うー! " | |
"(/・ω・)/にゃー!" | |
"(」・ω・)」うー! " | |
"(/・ω・)/にゃー!" | |
"Let's\(・ω・)/にゃー!" | |
)) | |
(defvar u-nya:index 0) | |
(defun u-nya:update () | |
(setq global-mode-string (propertize (nth u-nya:index u-nya:pattern) 'face 'u-nya:face)) | |
(setq u-nya:index (if (= u-nya:index (1- (length u-nya:pattern))) | |
0 | |
(1+ u-nya:index)))) | |
;;;###autoload | |
(define-minor-mode u-nya-mode | |
"" | |
:global t :group 'u-nya | |
(if u-nya-mode | |
(progn | |
(add-hook 'post-command-hook 'u-nya:update)) | |
(progn | |
(setq global-mode-string "") | |
(remove-hook 'post-command-hook 'u-nya:update)))) | |
(provide 'u-nya-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment