Make sure the Nyan prompt in eshell always works

Gergely Polonkai 5 years ago
parent 84e1b7ab32
commit 6b7b2d67c6

@ -1314,9 +1314,7 @@ The cookies are from the Hungarian version an ancient MS-DOS based program calle
#+BEGIN_SRC emacs-lisp
(when (display-graphic-p)
(use-package nyan-prompt
:ensure nil
(add-hook 'eshell-load-hook 'nyan-prompt-enable)))
:ensure nil))
*** Zone out with Nyancat
@ -1439,7 +1437,9 @@ Highlight point. Sometimes its not easy to see.
(with-eval-after-load "esh-opt"
(autoload 'epe-theme-lambda "eshell-prompt-extras")
(setq eshell-highlight-prompt nil
eshell-prompt-function 'epe-theme-lambda)))
eshell-prompt-function 'epe-theme-lambda)
(when (featurep 'nyan-prompt)
*** Show form feeds as a horizontal line

@ -34,18 +34,26 @@
(propertize nyan-prompt-nyan-cat-emoticon
'display nyan-prompt-nyan-cat-image))
(defvar nyan-prompt-original-prompt 'eshell-prompt-function
(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 ()
(setq eshell-prompt-function 'nyan-prompt-original-prompt))
(when nyan-prompt-enabled
(setq nyan-prompt-enabled nil
eshell-prompt-function nyan-prompt-original-prompt)))
(defun nyan-prompt-enable ()
(setq eshell-prompt-function 'eshell-nyan-prompt))
(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)