Subject: bug#68785: closed (Re: bug#68785: [PATCH] Fix volume refresh bug in mpc)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 10 Feb 2024 08:56:05 +0000

Your bug report

#68785: [PATCH] Fix volume refresh bug in mpc

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
68785: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68785
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#68785: [PATCH] Fix volume refresh bug in mpc
From: Eli Zaretskii <[email-masked]>
To: john muhl <[email-masked]>
Cc: [email-masked]
Date: Sat, 10 Feb 2024 10:23:36 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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" <[email-masked]>
> 
> >From 52f94878d94a6a3b9d59b53e720230546d881a2a Mon Sep 17 00:00:00 2001
> From: john muhl <[email-masked]>
> 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.

Subject: [PATCH] Fix volume refresh bug in mpc
From: john muhl <[email-masked]>
To: [email-masked]
Date: Sun, 28 Jan 2024 14:17:31 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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'