Function: ghostel-default-progress

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

Signature

(ghostel-default-progress STATE PROGRESS)

Documentation

Default handler for OSC 9;4 ConEmu progress reports.

Shows STATE and PROGRESS in mode-line-process. STATE is one of remove, set, error, indeterminate, or pause; PROGRESS is an integer 0-100 or nil.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-default-progress (state progress)
  "Default handler for OSC 9;4 ConEmu progress reports.
Shows STATE and PROGRESS in `mode-line-process'.  STATE is one of
`remove', `set', `error', `indeterminate', or `pause'; PROGRESS is
an integer 0-100 or nil."
  (let ((new-val
         (pcase state
           ('remove        nil)
           ('set           (format " [%d%%]" (or progress 0)))
           ('indeterminate " [...]")
           ('error         (propertize (if progress
                                           (format " [err %d%%]" progress)
                                         " [err]")
                                       'face 'error))
           ('pause         (if progress
                               (format " [paused %d%%]" progress)
                             " [paused]"))
           ;; Unknown state: keep the current progress value rather
           ;; than silently clearing it, so a future Zig-side state is
           ;; visible-but-stale instead of disappearing.
           (_              ghostel--mode-line-progress))))
    (unless (equal new-val ghostel--mode-line-progress)
      (setq ghostel--mode-line-progress new-val)
      (ghostel--mode-line-refresh))))