Fix volume refresh bug in mpc

* lisp/mpc.el (mpc-volume-refresh): Only refresh volume when mpd
is playing.  When stopped or paused, volume is nil.  (Bug#68785)
This commit is contained in:
john muhl 2024-01-25 21:23:45 -06:00 committed by Eli Zaretskii
parent 6195a57b8e
commit 4330eb2864

View file

@ -1867,11 +1867,14 @@ A value of t means the main playlist.")
(defvar mpc-volume nil) (put 'mpc-volume 'risky-local-variable t)
(defun mpc-volume-refresh ()
;; Maintain the volume.
(setq mpc-volume
(mpc-volume-widget
(string-to-number (cdr (assq 'volume mpc-status)))))
(let ((status-buf (mpc-proc-buffer (mpc-proc) 'status)))
"Maintain the volume."
(let ((status-buf (mpc-proc-buffer (mpc-proc) 'status))
(status-vol (cdr (assq 'volume mpc-status))))
;; If MPD is paused or stopped the volume is nil.
(when status-vol
(setq mpc-volume
(mpc-volume-widget
(string-to-number status-vol))))
(when (buffer-live-p status-buf)
(with-current-buffer status-buf (force-mode-line-update)))))