Function: ghostel-spinner-progress

ghostel-spinner-progress is a natively compiled function defined in ghostel.el.

Signature

(ghostel-spinner-progress STATE PROGRESS)

Documentation

Spinner-driven handler for OSC 9;4 ConEmu progress reports.

Animates mode-line-process via spinner.el during indeterminate progress; falls back to a static text indicator (matching ghostel-default-progress) for set, error, pause, and remove. STATE is one of those symbols; PROGRESS is an integer 0-100 or nil.

Requires spinner.el to be available; signals a user-error on the first call if it is not. The spinner style is controlled by ghostel-spinner-type.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-spinner-progress (state progress)
  "Spinner-driven handler for OSC 9;4 ConEmu progress reports.
Animates `mode-line-process' via spinner.el during indeterminate
progress; falls back to a static text indicator (matching
`ghostel-default-progress') for `set', `error', `pause', and `remove'.
STATE is one of those symbols; PROGRESS is an integer 0-100 or nil.

Requires spinner.el to be available; signals a `user-error' on
the first call if it is not.  The spinner style is controlled by
`ghostel-spinner-type'."
  (unless (require 'spinner nil t)
    (user-error
     "Cannot run `ghostel-spinner-progress' without spinner.el — install it \
from MELPA or set `ghostel-progress-function' to #'ghostel-default-progress"))
  (if (eq state 'indeterminate)
      ;; Indeterminate: install spinner.el's mode-line construct.
      ;; Clear any prior determinate text first so the spinner shows
      ;; alone, not appended to a stale " [50%]".
      (unless ghostel--spinner-active
        (setq ghostel--mode-line-progress nil
              ghostel--spinner-active t)
        ;; spinner-start mutates `mode-line-process' directly; the
        ;; refresh below overwrites it with the composed value so the
        ;; input-mode tag stays visible alongside the spinner.
        (spinner-start ghostel-spinner-type)
        (ghostel--mode-line-refresh))
    ;; Any other state: stop the spinner and let the text indicator
    ;; take over.  `ghostel--spinner-stop' refreshes the mode-line so
    ;; the spinner construct disappears even if the new progress text
    ;; happens to equal the old one.
    (ghostel--spinner-stop)
    (ghostel-default-progress state progress)))