emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/listen 214b87215c 067/103: Fix: (listen-mode-lighter)


From: ELPA Syncer
Subject: [elpa] externals/listen 214b87215c 067/103: Fix: (listen-mode-lighter)
Date: Mon, 26 Feb 2024 12:59:30 -0500 (EST)

branch: externals/listen
commit 214b87215c087a99ef3f78a7284900231d592f7a
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Fix: (listen-mode-lighter)
---
 listen.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/listen.el b/listen.el
index b2c5a08702..357114625e 100755
--- a/listen.el
+++ b/listen.el
@@ -196,10 +196,15 @@ command with completion."
   (cl-labels ((format-time (seconds)
                 (format-seconds "%h:%z%.2m:%.2s" seconds))
               (format-track ()
-                (when-let ((info (listen--info listen-player)))
-                  (format "%s: %s" (alist-get "artist" info nil nil #'equal)
-                          (truncate-string-to-width (alist-get "title" info 
nil nil #'equal)
-                                                    
listen-lighter-title-max-length nil nil t))))
+                (when-let ((info (listen--info listen-player))
+                           ;; Sometimes when paused/stopped, the artist and/or
+                           ;; title are nil even if info isn't, so we must
+                           ;; check before treating them as strings.
+                           (artist (alist-get "artist" info nil nil #'equal))
+                           (title (alist-get "title" info nil nil #'equal)))
+                  (format "%s: %s" artist
+                          (truncate-string-to-width
+                           title listen-lighter-title-max-length nil nil t))))
               (format-status ()
                 (pcase (listen--status listen-player)
                   ("playing" "▶")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]