diff --git a/configuration.org b/configuration.org index 035d9f8..fffbd40 100644 --- a/configuration.org +++ b/configuration.org @@ -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 - :config - (add-hook 'eshell-load-hook 'nyan-prompt-enable))) + :ensure nil)) #+END_SRC *** Zone out with Nyancat @@ -1439,7 +1437,9 @@ Highlight point. Sometimes it’s 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) + (nyan-prompt-enable)))) #+END_SRC *** Show form feeds as a horizontal line diff --git a/lisp/nyan-prompt/nyan-prompt.el b/lisp/nyan-prompt/nyan-prompt.el index f025cea..3097c7c 100644 --- a/lisp/nyan-prompt/nyan-prompt.el +++ b/lisp/nyan-prompt/nyan-prompt.el @@ -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))) ;;;###autoload (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)