From 93bc015e8f41f75b4a4ce2a1a19a91fe5b998901 Mon Sep 17 00:00:00 2001 From: Shannon Spires Date: Tue, 6 Mar 2018 08:40:38 -0700 Subject: [PATCH] In format-logical-block, the check for non-empty *format-arguments* should only happen in the (not asign) case. Per GZ. Fixes Issue #112. --- lib/format.lisp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/format.lisp b/lib/format.lisp index b4f8c0995..e2fad5ad4 100644 --- a/lib/format.lisp +++ b/lib/format.lisp @@ -980,22 +980,22 @@ and (nthcdr *format-arguments-variance* *format-arguments*)") (when end-atsign (setq body-string (format-fill-transform body-string))) (format-check-simple prefix) (format-check-simple suffix) - (unless *format-arguments* - (setq *format-index* start) - (format-error "Missing argument")) (let ((args (if (not atsign) - ; This piece of garbage is needed to avoid double length counting from (formatter ...) things - ; but also to allow (flet . t) not to barf. - ; Was formerly simply (if *format-arguments* (pop-format-arg)) - ; Actually wanna not count the arg iff the ~< is at the top level - ; in a format string i.e. "is this the first ~< in THIS string?" - (when *format-arguments* - (if (and (listp *format-arguments*) - (first-block-p start)) - (pop *format-arguments*) ; dont count - (pop-format-arg))) ; unless not listp or not first - (prog1 *format-arguments* - (setq *format-arguments* nil)))) + ; This piece of garbage is needed to avoid double length counting from (formatter ...) things + ; but also to allow (flet . t) not to barf. + ; Was formerly simply (if *format-arguments* (pop-format-arg)) + ; Actually wanna not count the arg iff the ~< is at the top level + ; in a format string i.e. "is this the first ~< in THIS string?" + (if *format-arguments* + (if (and (listp *format-arguments*) + (first-block-p start)) + (pop *format-arguments*) ; dont count + (pop-format-arg)) ; unless not listp or not first + (progn + (setq *format-index* start) + (format-error "Missing argument"))) + (prog1 *format-arguments* + (setq *format-arguments* nil)))) (*format-control-string* body-string) (*format-top-level* (and atsign *format-top-level*))) (let ((*logical-block-p* t)