Following expression:
(with-output-to-string (s)
(princ "foo" s)
(princ "bar
" s))
Prints a newline between "foo" and "baz", which is incorrect.
Related: https://github.com/mmontone/djula/issues/88
Same code using write-string instead of princ doesn't output the extra newline, which is correct.
My machine:
marian@gimli ~/src/clisp-clisp $ uname -a
Linux gimli 5.4.0-165-generic #182-Ubuntu SMP Mon Oct 2 19:43:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
marian@gimli ~/src/clisp-clisp $ clisp --version
GNU CLISP 2.49.93+ (2018-02-18) (compilado 3910960852) (memoria 3910961376)
Software: GNU C 9.4.0
gcc -g -O2 -no-integrated-cpp -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -Wno-shift-negative-value -O -fwrapv -fno-strict-aliasing -DNO_ASM -DENABLE_UNICODE -DDYNAMIC_MODULES libgnu.a -lreadline -lncurses -ldl -lsigsegv -lunistring
SAFETY=0 HEAPCODES ONE_FREE_BIT_HEAPCODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.12
libreadline 8.0
Features:
(REGEXP WILDCARD SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP
LISP=CL INTERPRETER LOGICAL-PATHNAMES SOCKETS GENERIC-STREAMS SCREEN GETTEXT
UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp)
Installation directory: /usr/local/lib/clisp-2.49.93+/
User language: ENGLISH
Machine: X86_64 (X86_64) gimli [127.0.1.1]
This is a consequence of
*PRINT-PRETTY*and*PPRINT-FIRST-NEWLINE*being true. Documented at https://clisp.sourceforge.io/impnotes.html#ppr-first-newline .Not a bug.