2018-08-06 06:25:08 +00:00
|
|
|
;;; nyan-prompt.el --- Nyan Cat on the eshell prompt.
|
|
|
|
|
|
|
|
;; Author: Javier "PuercoPop" Olaechea <pirata@gmail.com>
|
|
|
|
;; URL: http://github.com/PuercoPop/nyan-prompt
|
|
|
|
;; Version: 0.2.0
|
|
|
|
;; Keywords: nyan, cat, lulz, eshell, rainbow
|
|
|
|
;; Dependencies ((rx 0))
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Usage: (add-hook 'eshell-load-hook 'nyan-prompt-enable)
|
|
|
|
|
|
|
|
;; Inspired by from Jacek "TeMPOraL" Zlydach nyan-mode, to make Porter happy.
|
|
|
|
|
|
|
|
|
|
|
|
;; Copying is an act of love, please copy. ♡
|
|
|
|
;; The xpm taken awesome nyan-mode
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'rx)
|
|
|
|
|
|
|
|
(defconst nyan-prompt-dir (file-name-directory
|
|
|
|
(or load-file-name buffer-file-name)))
|
|
|
|
|
|
|
|
(defconst nyan-prompt-nyan-cat-image
|
|
|
|
(create-image (concat nyan-prompt-dir "img/nyan.xpm")
|
|
|
|
'xpm nil :ascent 'center))
|
|
|
|
|
|
|
|
(defconst nyan-prompt-nyan-cat-emoticon "~=[,,_,,]:3"
|
|
|
|
"ASCII art representing the nyan-cat.")
|
|
|
|
|
|
|
|
(defconst nyan-prompt-nyan-cat-string
|
|
|
|
(propertize nyan-prompt-nyan-cat-emoticon
|
|
|
|
'display nyan-prompt-nyan-cat-image))
|
|
|
|
|
2018-08-28 16:12:52 +00:00
|
|
|
(defvar nyan-prompt-original-prompt nil
|
2018-08-06 06:25:08 +00:00
|
|
|
"The eshell prompt function before enabling nyan-prompt")
|
|
|
|
|
2018-08-28 16:12:52 +00:00
|
|
|
(defvar nyan-prompt-enabled nil
|
|
|
|
"t if nyan-prompt is enabled")
|
|
|
|
|
2018-08-06 06:25:08 +00:00
|
|
|
(defun eshell-nyan-prompt ()
|
|
|
|
(concat nyan-prompt-nyan-cat-string " " (funcall nyan-prompt-original-prompt)))
|
|
|
|
|
|
|
|
(defun nyan-prompt-disable ()
|
2018-08-28 16:12:52 +00:00
|
|
|
(when nyan-prompt-enabled
|
|
|
|
(setq nyan-prompt-enabled nil
|
|
|
|
eshell-prompt-function nyan-prompt-original-prompt)))
|
2018-08-06 06:25:08 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun nyan-prompt-enable ()
|
2018-08-28 16:12:52 +00:00
|
|
|
(when (not nyan-prompt-enabled)
|
|
|
|
(setq nyan-prompt-enabled t
|
|
|
|
nyan-prompt-original-prompt eshell-prompt-function
|
|
|
|
eshell-prompt-function 'eshell-nyan-prompt)))
|
2018-08-06 06:25:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
(provide 'nyan-prompt)
|
|
|
|
;;; nyan-prompt.el ends here
|