Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark modified buffers with a pale nyan cat #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions img/nyan-pale.xpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/* XPM */
static char *nyan[] = {
/* columns rows colors chars-per-pixel */
"25 15 136 2 ",
" c black",
". c #020F06",
"X c #070B0F",
"o c #08090C",
"O c #0C0C0C",
"+ c #1D1F00",
"@ c #020912",
"# c #000A14",
"$ c #131313",
"% c #161616",
"& c #191919",
"* c #251E17",
"= c #083417",
"- c #292B00",
"; c #3F1E31",
": c #04323D",
"> c #232323",
", c #222126",
"< c gray14",
"1 c gray15",
"2 c #2B2525",
"3 c #20262C",
"4 c #2A2A2A",
"5 c #3E2525",
"6 c #2C2F32",
"7 c gray20",
"8 c gray22",
"9 c #3A3C3E",
"0 c #54423f",
"q c #7C0B10",
"w c #453c34",
"e c #4C3100",
"r c #483F00",
"t c #504c49",
"y c #4B3C2D",
"u c #8c9c84",
"i c #6a6280",
"p c #241856",
"a c #1F265A",
"s c #584343",
"d c #414141",
"f c #464646",
"g c #4C4646",
"h c #494949",
"j c gray31",
"k c #514C51",
"l c gray34",
"z c #54575A",
"x c #5D5D5D",
"c c #5F5F5F",
"v c #6b645d",
"b c #614C61",
"n c #6D4C6D",
"m c gray38",
"M c #646464",
"N c gray40",
"B c #686868",
"V c #7B6C6C",
"C c #727272",
"Z c gray45",
"A c #7B7B7B",
"S c gray50",
"D c #a4896c",
"F c #e6d295",
"G c #8c9c84",
"H c #947256",
"J c #20980E",
"K c #1AAF4D",
"L c #20D15C",
"P c #868F00",
"I c #47597b",
"U c #597184",
"Y c #BF9973",
"T c #23308F",
"R c #263498",
"E c #39329C",
"W c #1354A2",
"Q c #5536D9",
"! c #5247F7",
"~ c #885788",
"^ c #A261A2",
"/ c #AA66AA",
"( c #AE68AE",
") c #836176",
"_ c #8c798c",
"` c #D17DD1",
"' c #836176",
"] c #897483",
"[ c #897483",
"{ c #7c6b79",
"} c #9c7891",
"| c #9c7891",
" . c #9c7891",
".. c #9c7891",
"X. c #4f7f8b",
"o. c #536b89",
"O. c gray59",
"+. c gray60",
"@. c #A68F8F",
"#. c #A89999",
"$. c #B09999",
"%. c #B59999",
"&. c #A0A0A0",
"*. c gray65",
"=. c #a68b8b",
"-. c #ba9797",
";. c #ba9797",
":. c #decdbd",
">. c #dec4b3",
",. c #c6b4ae",
"<. c #b4a1a1",
"1. c #dec7c6",
"2. c #d7d2cd",
"3. c #d1bca6",
"4. c #d1bca6",
"5. c #998599",
"6. c #a18295",
"7. c #c2aab2",
"8. c #b6a0b6",
"9. c #896d84",
"0. c #896d84",
"q. c #896d84",
"w. c #896d84",
"e. c #a98aa6",
"r. c #a98aa6",
"t. c #a98aa6",
"y. c #b195af",
"u. c #9c829a",
"i. c #b195af",
"p. c #b195af",
"a. c #b195af",
"s. c #b6a2b6",
"d. c #9e909e",
"f. c #b390a6",
"g. c gray81",
"h. c None",
/* pixels */
"s s s s s s s t t t t t t t t t t t t t h.h.h.h.h.",
"s s s s s s t 7.7.7.7.7.7.7.7.7.7.7.7.7.9 h.h.h.h.",
"D D D D D 0 2.1.s.s.s.s.) s.' i.s.s.d.3.v h.h.h.h.",
"D D D D D w ,.s.' i.s.s.s.s.5._ u.e.p.f.v h.h.h.h.",
"F F F F F e ,.s.s.s.s.s.s.` b j / .i.f.v h.j h.h.",
"F F F F F r ,.s.s.s.s.' i.^ x O.x / u.f.v x O.d h.",
"F 1 1 + P - ,.s.s.0.s.s.s.^ x +.+.x 2 2 m +.+.j h.",
"G C +.j 4 ,.s.s.| s.s.] n A +.+.+.+.+.+.+.+.C h.",
"G u 1 1 h 1 ,. .9.s.s.s.{ 8 +.&.&.B +.+.+.g.g +.1 ",
"I I I I = . ,.s.s.s.e.i.8.8 #.@., m +.A N 9 g $.2 ",
"I I I I I : >.f. .i.0.0.8.8 =.-.H O.+.m +.c $.;.5 ",
"U U U U W # 2.4.6.s.s.s.t.~ V $.m $ 1 O 3 # +.V h.",
"U U U E 4 1 * Y Y Y Y Y Y Y y m C C C C C C z h.h.",
"i i i 1 +.m p & j X h.h.h.h.# d 7 h.h.j 1 h.h.h.h.",
"i i i o 1 a T a 1 h.h.h.h.h.h.3 & h.h.1 $ h.h.h.h."
};
28 changes: 28 additions & 0 deletions img/rainbow-pale.xpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* XPM */
static char *rainbow[] = {
/* columns rows colors chars-per-pixel */
"8 15 7 1",
"1 c #584343",
"2 c #a4896c",
"3 c #e6d295",
"4 c #8c9c84",
"5 c #47597b",
"6 c #597184",
"7 c #6a6280",
/* pixels */
"11111111",
"11111111",
"22222222",
"22222222",
"33333333",
"33333333",
"33333333",
"44444444",
"44444444",
"55555555",
"55555555",
"66666666",
"66666666",
"77777777",
"77777777"
};
37 changes: 33 additions & 4 deletions nyan-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
(defconst +nyan-cat-size+ 3)

(defconst +nyan-cat-image+ (concat +nyan-directory+ "img/nyan.xpm"))
(defconst +nyan-cat-pale-image+ (concat +nyan-directory+ "img/nyan-pale.xpm"))

(defconst +nyan-rainbow-image+ (concat +nyan-directory+ "img/rainbow.xpm"))
(defconst +nyan-rainbow-pale-image+ (concat +nyan-directory+ "img/rainbow-pale.xpm"))

(defconst +nyan-outerspace-image+ (concat +nyan-directory+ "img/outerspace.xpm"))

(defconst +nyan-music+ (concat +nyan-directory+ "mus/nyanlooped.mp3"))
Expand All @@ -82,6 +86,15 @@ Intended to be called when customizations were changed, to reapply them immediat
(nyan-mode -1)
(nyan-mode 1))))

(defcustom nyan-mark-modified-buffers nil
"If enabled, modified buffers show a pale nyan cat."
:type '(choice (const :tag "Enabled" t)
(const :tag "Disabled" nil))
:set (lambda (sym val)
(set-default sym val)
(nyan-refresh))
:group 'nyan)

(defcustom nyan-animation-frame-interval 0.2
"Number of seconds between animation frames."
:type 'float
Expand Down Expand Up @@ -163,6 +176,19 @@ This can be t or nil."
(defvar nyan-cat-image (if (image-type-available-p 'xpm)
(create-image +nyan-cat-image+ 'xpm nil :ascent 'center)))

(defvar nyan-cat-pale-image (if (image-type-available-p 'xpm)
(create-image +nyan-cat-pale-image+ 'xpm nil :ascent 'center)))

(defun nyan-rainbow-image (number)
(create-image +nyan-rainbow-image+ 'xpm nil :ascent (or (and nyan-wavy-trail
(nyan-wavy-rainbow-ascent number))
(if (nyan--is-animating-p) 95 'center))))

(defun nyan-rainbow-pale-image (number)
(create-image +nyan-rainbow-pale-image+ 'xpm nil :ascent (or (and nyan-wavy-trail
(nyan-wavy-rainbow-ascent number))
(if (nyan--is-animating-p) 95 'center))))

(defvar nyan-animation-frames (if (image-type-available-p 'xpm)
(mapcar (lambda (id)
(create-image (concat +nyan-directory+ (format "img/nyan-frame-%d.xpm" id))
Expand Down Expand Up @@ -194,7 +220,10 @@ This can be t or nil."
(defun nyan-get-anim-frame ()
(if (nyan--is-animating-p)
(nth nyan-current-frame nyan-animation-frames)
nyan-cat-image))
;; TODO Support animating pale nyan cat
(if (and nyan-mark-modified-buffers (buffer-modified-p))
nyan-cat-pale-image
nyan-cat-image)))

(defun nyan-wavy-rainbow-ascent (number)
(if (nyan--is-animating-p)
Expand Down Expand Up @@ -253,9 +282,9 @@ This can be t or nil."
(nyan-add-scroll-handler
(if xpm-support
(propertize "|"
'display (create-image +nyan-rainbow-image+ 'xpm nil :ascent (or (and nyan-wavy-trail
(nyan-wavy-rainbow-ascent number))
(if (nyan--is-animating-p) 95 'center))))
'display (if (and nyan-mark-modified-buffers (buffer-modified-p))
(nyan-rainbow-pale-image number)
(nyan-rainbow-image number)))
"|")
(/ (float number) nyan-bar-length) buffer))))
(dotimes (number outerspaces)
Expand Down