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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68785 in the body.
You can then email your comments to 68785 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#68785; Package emacs. (Sun, 28 Jan 2024 20:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to john muhl <jm <at> pub.pink>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 28 Jan 2024 20:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix volume refresh bug in mpc
Date: Sun, 28 Jan 2024 14:17:31 -0600
Tags: patch

When mpd is stopped or paused the volume returned is nil which
causes the string-to-number in mpc-volume-refresh to error.

  emacs -Q
  M-x toggle-debug-on-error
  M-: (setopt mpc-host "hifi.lan")
  M-x mpc
  …with something in the playlist
  M-: (mpc-play)
  M-: (mpc-stop)

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    string-to-number(nil)
    (mpc-volume-widget (string-to-number (cdr (assq 'volume mpc-status))))
    (setq mpc-volume (mpc-volume-widget (string-to-number (cdr (assq 'volume mpc-status)))))
    mpc-volume-refresh()
    funcall(mpc-volume-refresh)
    (progn (funcall (cdr pair)))
    (if (or (eq t (car pair)) (not (equal (cdr (assq (car pair) old-status)) (cdr (assq (car pair) mpc-status))))) (progn (funcall (cdr pair))))
    (let ((pair (car tail))) (if (or (eq t (car pair)) (not (equal (cdr (assq (car pair) old-status)) (cdr (assq (car pair) mpc-status))))) (progn (funcall (cdr pair)))) (setq tail (cdr tail)))
    (while tail (let ((pair (car tail))) (if (or (eq t (car pair)) (not (equal (cdr (assq ... old-status)) (cdr (assq ... mpc-status))))) (progn (funcall (cdr pair)))) (setq tail (cdr tail))))
    (let ((tail mpc-status-callbacks)) (while tail (let ((pair (car tail))) (if (or (eq t (car pair)) (not (equal (cdr ...) (cdr ...)))) (progn (funcall (cdr pair)))) (setq tail (cdr tail)))))
    (if (equal old-status mpc-status) nil (let ((tail mpc-status-callbacks)) (while tail (let ((pair (car tail))) (if (or (eq t (car pair)) (not (equal ... ...))) (progn (funcall (cdr pair)))) (setq tail (cdr tail))))))
    (let ((old-status mpc-status)) (setq mpc-status (mpc-proc-buf-to-alist)) (progn (or mpc-status (cl--assertion-failed 'mpc-status)) nil) (if (equal old-status mpc-status) nil (let ((tail mpc-status-callbacks)) (while tail (let ((pair (car tail))) (if (or (eq t ...) (not ...)) (progn (funcall ...))) (setq tail (cdr tail)))))))
    mpc--status-callback()
    (closure ((cb)) nil (mpc--status-callback) (if cb (funcall cb)))()
    funcall((closure ((cb)) nil (mpc--status-callback) (if cb (funcall cb))))
    (let ((callback (process-get proc 'callback))) (process-put proc 'callback nil) (if error-text (process-put proc 'mpc-proc-error error-text)) (funcall callback))
    (let ((error-text (match-string 1))) (delete-region (point) (point-max)) (let ((callback (process-get proc 'callback))) (process-put proc 'callback nil) (if error-text (process-put proc 'mpc-proc-error error-text)) (funcall callback)))
    (progn (process-put proc 'ready t) (if (eq (match-end 0) (point-max)) nil (error "Unexpected trailing text")) (let ((error-text (match-string 1))) (delete-region (point) (point-max)) (let ((callback (process-get proc 'callback))) (process-put proc 'callback nil) (if error-text (process-put proc 'mpc-proc-error error-text)) (funcall callback))))
    (if (and (< start (point)) (re-search-backward mpc--proc-end-re start t)) (progn (process-put proc 'ready t) (if (eq (match-end 0) (point-max)) nil (error "Unexpected trailing text")) (let ((error-text (match-string 1))) (delete-region (point) (point-max)) (let ((callback (process-get proc 'callback))) (process-put proc 'callback nil) (if error-text (process-put proc 'mpc-proc-error error-text)) (funcall callback)))))
    (let ((start (or (marker-position (process-mark proc)) (point-min)))) (goto-char start) (insert string) (move-marker (process-mark proc) (point)) (beginning-of-line) (if (and (< start (point)) (re-search-backward mpc--proc-end-re start t)) (progn (process-put proc 'ready t) (if (eq (match-end 0) (point-max)) nil (error "Unexpected trailing text")) (let ((error-text (match-string 1))) (delete-region (point) (point-max)) (let ((callback (process-get proc ...))) (process-put proc 'callback nil) (if error-text (process-put proc 'mpc-proc-error error-text)) (funcall callback))))))
    (save-excursion (let ((start (or (marker-position (process-mark proc)) (point-min)))) (goto-char start) (insert string) (move-marker (process-mark proc) (point)) (beginning-of-line) (if (and (< start (point)) (re-search-backward mpc--proc-end-re start t)) (progn (process-put proc 'ready t) (if (eq (match-end 0) (point-max)) nil (error "Unexpected trailing text")) (let ((error-text (match-string 1))) (delete-region (point) (point-max)) (let ((callback ...)) (process-put proc 'callback nil) (if error-text (process-put proc ... error-text)) (funcall callback)))))))
    (if (process-get proc 'ready) (if nil nil (delete-process proc) (set-process-buffer proc nil) (pop-to-buffer (clone-buffer)) (error "MPD output while idle!?")) (save-excursion (let ((start (or (marker-position (process-mark proc)) (point-min)))) (goto-char start) (insert string) (move-marker (process-mark proc) (point)) (beginning-of-line) (if (and (< start (point)) (re-search-backward mpc--proc-end-re start t)) (progn (process-put proc 'ready t) (if (eq (match-end 0) (point-max)) nil (error "Unexpected trailing text")) (let ((error-text ...)) (delete-region (point) (point-max)) (let (...) (process-put proc ... nil) (if error-text ...) (funcall callback))))))))
    (save-current-buffer (set-buffer (process-buffer proc)) (if (process-get proc 'ready) (if nil nil (delete-process proc) (set-process-buffer proc nil) (pop-to-buffer (clone-buffer)) (error "MPD output while idle!?")) (save-excursion (let ((start (or (marker-position ...) (point-min)))) (goto-char start) (insert string) (move-marker (process-mark proc) (point)) (beginning-of-line) (if (and (< start (point)) (re-search-backward mpc--proc-end-re start t)) (progn (process-put proc 'ready t) (if (eq ... ...) nil (error "Unexpected trailing text")) (let (...) (delete-region ... ...) (let ... ... ... ...))))))))
    mpc--proc-filter(#<process MPC> "repeat: 0\nrandom: 1\nsingle: 0\nconsume: 0\npartition: default\nplaylist: 55708\nplaylistlength: 0\nmixrampdb: 0\nstate: stop\nOK\n")




In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2024-01-21 built on thelio
Repository revision: 9364c28959a5b00e8ffd5d0d283ff0c0042f1bb0
Repository branch: master
System Description: Fedora Linux 39 (Thirty Nine)

Configured using:
 'configure --with-pgtk --prefix=/home/jm/.local'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68785; Package emacs. (Sun, 28 Jan 2024 20:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 68785 <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: 68785 <at> debbugs.gnu.org
Subject: Re: 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





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 10 Feb 2024 08:56:04 GMT) Full text and rfc822 format available.

Notification sent to john muhl <jm <at> pub.pink>:
bug acknowledged by developer. (Sat, 10 Feb 2024 08:56:05 GMT) Full text and rfc822 format available.

Message #13 received at 68785-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: john muhl <jm <at> pub.pink>
Cc: 68785-done <at> debbugs.gnu.org
Subject: Re: bug#68785: [PATCH] Fix volume refresh bug in mpc
Date: Sat, 10 Feb 2024 10:23:36 +0200
> Date: Sun, 28 Jan 2024 14:22:16 -0600
> From:  john muhl via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> >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)

Thanks, installed on master, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 09 Mar 2024 12:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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