an extra newline is inserted in the format output when
*print-pretty* is non-NIL:
(format nil "~{~a~}" (list "string1" "string2"
(concatenate 'string "string3" (string #\newline))))
"string1string2
string3
"
(let ((*print-pretty* nil)) (format nil "~{~a~}" (list
"string1" "string2" (concatenate 'string "string3"
(string #\newline)))))
"string1string2string3
"
http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/350c664e996b151d/067f8812cfe47221
Logged In: YES
user_id=625598
This looks very similar to a bug I found in (princ), so I
thought I would post it here. This:
--test.lisp--
(princ "hello") (princ "goodbye
") ; newline intended
(princ "hello") (princ "goodbye")
--test.lisp--
Prints:
hello
goodbye
hellogoodbye
But it should print:
hellogoodbye
hellogoodbye
HTH,
Matt
Logged In: YES
user_id=5735
this behavior is controlled by
*PPRINT-FIRST-NEWLINE* (see impnotes)
the issue is
---- initial value (for princ)
---- should is also influence format
Logged In: YES
user_id=625598
Hey Sam,
Thanks for the response, but that doesn't affect it. If I
turn off the *print-pretty* option it will do what I want,
but the *pprint-first-newline* option doesn't appear to do
anything.
Matt
Logged In: YES
user_id=5735
Originator: YES
please try the appended patch:
--- io.d 27 Dec 2006 13:35:53 -0500 1.304
+++ io.d 27 Dec 2006 15:44:32 -0500
@@ -6629,6 +6629,8 @@
}
if (eq(Symbol_value(S(prin_l1)),Fixnum_0)) # or at position 0 ?
skip_first_nl = true;
+ if (nullpSv(pprint_first_newline)) /* use asked: no first newlines */
+ skip_first_nl = true;
if (nullp(Cdr(Cdr(STACK_0)))) { # DEFINITELY a single-liner
skip_first_nl = true;
} else { # several lines, maybe still a single-liner?
@@ -6645,8 +6647,7 @@
fit_this_line = (pphs_len_i <= (prm_i - pos_i));
if (pphs_len_i > prm_i)
TheStream(ppstream)->strm_pphelp_modus = mehrzeiler;
- if (fit_this_line
- || nullpSv(pprint_first_newline))
+ if (fit_this_line)
skip_first_nl = true;
}
if (skip_first_nl && !fit_this_line)
Logged In: YES
user_id=5735
Originator: YES
thank you for your bug report.
the bug has been fixed in the CVS tree.
you can either wait for the next release (recommended)
or check out the current CVS tree (see http://clisp.cons.org\)
and build CLISP from the sources (be advised that between
releases the CVS tree is very unstable and may not even build
on your platform).