From a441435f3e33232cbd9512b79d32f24c572c4fd3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 27 Jul 2019 17:05:17 +0200 Subject: [PATCH] Fix debug helper for format! Throwing format errors when there are no arguments. Also makes relpath a little more lenient about nil/empty input. --- core/autoload/format.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/core/autoload/format.el b/core/autoload/format.el index 534950bd6..7de5af711 100644 --- a/core/autoload/format.el +++ b/core/autoload/format.el @@ -50,15 +50,24 @@ and `format!' into colored output, where COLOR is any car of this list.") (concat "- " (if args (apply #'format str args) str)))) (start . (lambda (str &rest args) (concat "> " (if args (apply #'format str args) str)))) - (debug . (lambda (str &rest args) (if doom-debug-mode (apply #'format str args) ""))) + (debug . (lambda (str &rest args) + (if doom-debug-mode + (if args + (apply #'format str args) + (format "%s" str)) + ""))) (path . abbreviate-file-name) (symbol . symbol-name) (relpath . (lambda (str &optional dir) - (let ((dir (or dir (file-truename default-directory))) - (str (file-truename str))) - (if (file-in-directory-p str dir) - (file-relative-name str dir) - (abbreviate-file-name str))))) + (if (or (not str) + (not (stringp str)) + (string-empty-p str)) + str + (let ((dir (or dir (file-truename default-directory))) + (str (file-truename str))) + (if (file-in-directory-p str dir) + (file-relative-name str dir) + (abbreviate-file-name str)))))) (filename . file-name-nondirectory) (dirname . (lambda (path) (unless (file-directory-p path)