GNU bug report logs - #68785
[PATCH] Fix volume refresh bug in mpc

Previous Next

Package: emacs;

Reported by: john muhl <jm <at> pub.pink>

Date: Sun, 28 Jan 2024 20:18:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: john muhl <jm <at> pub.pink>
To: 68785 <at> debbugs.gnu.org
Subject: bug#68785: Acknowledgement ([PATCH] Fix volume refresh bug in mpc)
Date: Sun, 28 Jan 2024 14:22:16 -0600
[0001-Fix-volume-refresh-bug-in-mpc.patch (text/x-patch, attachment)]
From 52f94878d94a6a3b9d59b53e720230546d881a2a Mon Sep 17 00:00:00 2001
From: john muhl <jm <at> pub.pink>
Date: Thu, 25 Jan 2024 21:23:45 -0600
Subject: [PATCH] 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)
---
 lisp/mpc.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index 9577e0f2f42..768c70c2e3a 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1867,11 +1867,14 @@ mpc-volume-map
 (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)))))
 
-- 
2.41.0





This bug report was last modified 1 year and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.