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

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

[elpa] externals/repology e1df51e1c5: repology-utils: Handle colorizatio


From: Nicolas Goaziou
Subject: [elpa] externals/repology e1df51e1c5: repology-utils: Handle colorization with missing information
Date: Fri, 11 Feb 2022 03:33:08 -0500 (EST)

branch: externals/repology
commit e1df51e1c575498cab8907296786e2040cbb1654
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    repology-utils: Handle colorization with missing information
    
    * repology-utils.el (repology-package-colorized-status):
    (repology-package-colorized-version): When trying to colorize nil,
    return "-" instead of raising an error or returning nil.
---
 repology-utils.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/repology-utils.el b/repology-utils.el
index bd7877ba69..d4f5fd0264 100644
--- a/repology-utils.el
+++ b/repology-utils.el
@@ -132,17 +132,20 @@ Return PACKAGE's repository internal name if the full 
name is unknown."
 (defun repology-package-colorized-status (package)
   "Return colorized status string for PACKAGE.
 The version string is emphasized according to PACKAGE's status.
-Return nil if PACKAGE has no status field."
+Return \"-\" if PACKAGE has no status field."
   (let ((status (repology-package-field package 'status)))
-    (and (stringp status)
-         (propertize status 'face (repology--package-status-face package)))))
+    (if (stringp status)
+        (propertize status 'face (repology--package-status-face package))
+      "-")))
 
 (defun repology-package-colorized-version (package)
   "Return colorized version string for PACKAGE.
-The version string is emphasized according to PACKAGE's status."
-  (propertize (repology-package-field package 'version)
-              'face
-              (repology--package-status-face package)))
+The version string is emphasized according to PACKAGE's status.
+Return \"-\" if PACKAGE has no version field."
+  (let ((version (repology-package-field package 'version)))
+    (if (stringp version)
+        (propertize version 'face (repology--package-status-face package))
+      "-")))
 
 
 ;;; Projects



reply via email to

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