;;; nyan-prompt.el --- Nyan Cat on the eshell prompt. ;; Author: Javier "PuercoPop" Olaechea ;; 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)) (defvar nyan-prompt-original-prompt nil "The eshell prompt function before enabling nyan-prompt") (defvar nyan-prompt-enabled nil "t if nyan-prompt is enabled") (defun eshell-nyan-prompt () (concat nyan-prompt-nyan-cat-string " " (funcall nyan-prompt-original-prompt))) (defun nyan-prompt-disable () (when nyan-prompt-enabled (setq nyan-prompt-enabled nil eshell-prompt-function nyan-prompt-original-prompt))) ;;;###autoload (defun nyan-prompt-enable () (when (not nyan-prompt-enabled) (setq nyan-prompt-enabled t nyan-prompt-original-prompt eshell-prompt-function eshell-prompt-function 'eshell-nyan-prompt))) (provide 'nyan-prompt) ;;; nyan-prompt.el ends here