my-emacs-d/lisp/nyan-prompt/nyan-prompt.el
Gergely Polonkai fa6d517fe0 Add Nyan-prompt back to the config
Even though its license is not GPL compatible (thus, will never get back to MELPA), it’s still
free to use.
2018-08-06 08:27:51 +02:00

53 lines
1.4 KiB
EmacsLisp

;;; 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))
(defvar nyan-prompt-original-prompt 'eshell-prompt-function
"The eshell prompt function before enabling nyan-prompt")
(defun eshell-nyan-prompt ()
(concat nyan-prompt-nyan-cat-string " " (funcall nyan-prompt-original-prompt)))
(defun nyan-prompt-disable ()
(setq eshell-prompt-function 'nyan-prompt-original-prompt))
;;;###autoload
(defun nyan-prompt-enable ()
(setq eshell-prompt-function 'eshell-nyan-prompt))
(provide 'nyan-prompt)
;;; nyan-prompt.el ends here