branch: elpa/buttercup commit 52f0bec349619332d7a31c85a451601cb549cbbe Author: Ola Nilsson <ola.nils...@gmail.com> Commit: Ola Nilsson <ola.nils...@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.