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

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

[elpa] externals/emms 0f4bd0c551: * emms-browser.el: Fix bug in emms-bro


From: ELPA Syncer
Subject: [elpa] externals/emms 0f4bd0c551: * emms-browser.el: Fix bug in emms-browser-format-spec
Date: Wed, 29 Mar 2023 16:57:48 -0400 (EDT)

branch: externals/emms
commit 0f4bd0c551b6ec1debfa834464f28030ce9c287b
Author: Yoni Rabkin <yrk@gnu.org>
Commit: Yoni Rabkin <yrk@gnu.org>

    * emms-browser.el: Fix bug in emms-browser-format-spec
    
    Sometimes, emms-browser-format-spec will throw an "Invalid format
    character" error, even when supplied a valid character format. This
    happens because the propertized string returned by
    emms-browser-format-line may contain an item with a car but no cdr
    (e.g.: ("y") instead of ("y" . 2023)). This patch fixes that by
    throwing the error only if the propertized string doesn't contain the
    key. Then, in circumstances where it does contain the key but the
    value is nil, it will supply an empty string to the text formatting
    procedure.
    
    Patch by Scarlett McAllister
---
 emms-browser.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/emms-browser.el b/emms-browser.el
index 6a75cdb5c2..17698814ad 100644
--- a/emms-browser.el
+++ b/emms-browser.el
@@ -1847,9 +1847,12 @@ the text that it generates."
        ((looking-at "\\([-0-9.]*\\)\\([a-zA-Z]+\\)")
         (let* ((num (match-string 1))
                (spec (match-string 2))
-               (val (cdr (assoc spec specification))))
-          (unless val
+               (val-alist (assoc spec specification))
+               (val (cdr val-alist)))
+          (unless val-alist
             (error "Invalid format character: %s" spec))
+          ;; Value for a valid spec may not exist. Not an error, just nothing 
to show.
+          (unless val (setq val ""))
           ;; Pad result to desired length.
           (let ((text (format (concat "%" num "s") val)))
             ;; Insert first, to preserve text properties.



reply via email to

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