Function: ghostel--mode-line-refresh

ghostel--mode-line-refresh is a natively compiled function defined in ghostel.el.

Signature

(ghostel--mode-line-refresh)

Documentation

Recompute mode-line-process from tag + spinner + progress.

Composes ghostel--mode-line-tag, the spinner construct (when ghostel--spinner-active is non-nil), and ghostel--mode-line-progress so the input-mode label stays visible while a progress indicator or spinner is active. When only one component is active the value is that component directly (so callers and tests that expect a plain string keep working); otherwise it is a list mode-line construct.

Skips setq and force-mode-line-update when the composed value is unchanged — ghostel-default-progress calls this once per OSC 9;4 packet, and same-value packets must not fire FMLU.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--mode-line-refresh ()
  "Recompute `mode-line-process' from tag + spinner + progress.
Composes `ghostel--mode-line-tag', the spinner construct (when
`ghostel--spinner-active' is non-nil), and
`ghostel--mode-line-progress' so the input-mode label stays
visible while a progress indicator or spinner is active.  When
only one component is active the value is that component
directly (so callers and tests that expect a plain string keep
working); otherwise it is a list mode-line construct.

Skips `setq' and `force-mode-line-update' when the composed value
is unchanged — `ghostel-default-progress' calls this once per
OSC 9;4 packet, and same-value packets must not fire FMLU."
  (let* ((parts (delq nil
                      (list ghostel--mode-line-tag
                            (and ghostel--spinner-active
                                 'spinner--mode-line-construct)
                            ghostel--mode-line-progress
                            (and ghostel--password-mode-p
                                 (propertize " 🔒Password" 'face 'warning)))))
         (new-val (pcase parts
                    ('() nil)
                    (`(,only) only)
                    (_ parts))))
    (unless (equal new-val mode-line-process)
      (setq mode-line-process new-val)
      (force-mode-line-update))))