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

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

[nongnu] elpa/buttercup 52f0bec 305/340: Make buttercup-colorize treat n


From: ELPA Syncer
Subject: [nongnu] elpa/buttercup 52f0bec 305/340: Make buttercup-colorize treat nil as no color
Date: Thu, 16 Dec 2021 14:59:55 -0500 (EST)

branch: elpa/buttercup
commit 52f0bec349619332d7a31c85a451601cb549cbbe
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>

    Make buttercup-colorize treat nil as no color
    
    With COLOR passed as nil, just return the original string.
---
 buttercup.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/buttercup.el b/buttercup.el
index 20d75f3..3deceed 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -1792,9 +1792,12 @@ the capturing behavior."
      ,@body))
 
 (defun buttercup-colorize (string color)
-  "Format STRING with COLOR."
-  (let ((color-code (cdr (assoc color buttercup-colors))))
-    (format "\e[%sm%s\e[0m" color-code string)))
+  "Format STRING with COLOR.
+Return STRING unmodified if COLOR is nil."
+  (if color
+      (let ((color-code (cdr (assoc color buttercup-colors))))
+        (format "\e[%sm%s\e[0m" color-code string))
+    string))
 
 (defun buttercup-reporter-interactive (event arg)
   "Reporter for interactive sessions.



reply via email to

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