Fix bug in eshell-starship.el

This commit is contained in:
Alexander Rosenberg 2024-12-22 05:33:07 -08:00
parent 09914fc3a9
commit dc789627c0
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -492,12 +492,17 @@ For example, a revert. If there is no current operation, return nil."
(prog1
(and eshell-starship--last-start-time
eshell-starship--last-end-time
;; this must be here (not in a predicate) to ensure these values get
;; cleared
(<= 3 (- eshell-starship--last-end-time
eshell-starship--last-start-time))
(eshell-starship-format-span (- eshell-starship--last-end-time
eshell-starship--last-start-time)))
(setq eshell-starship--last-start-time nil
eshell-starship--last-end-time nil)))
(eshell-starship-defmodule cmd-time
:predicate 'always
:prefix "took "
:color "gold1"
:reload-on 'always
@ -505,11 +510,6 @@ For example, a revert. If there is no current operation, return nil."
(setq eshell-starship--last-start-time (float-time)))
:postcmd-action (lambda ()
(setq eshell-starship--last-end-time (float-time)))
:predicate (lambda ()
(and eshell-starship--last-start-time
eshell-starship--last-end-time
(<= 3 (- eshell-starship--last-end-time
eshell-starship--last-start-time))))
:action 'eshell-starship--last-command-time
:doc "The amount of time it took the last command to execute.")