GNU bug report logs -
#76715
30.1; Issues when pretty printing lists with elements ending with a dot
Previous Next
Reported by: pkryger <at> gmail.com
Date: Mon, 3 Mar 2025 16:25:01 UTC
Severity: normal
Found in version 30.1
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: pkryger <at> gmail.com
> Date: Mon, 03 Mar 2025 16:22:04 +0000
>
>
> The defualt pretty printing function `pp-fill' yields different output than the expression to be printed. I managed to simplify the cases to the following:
>
> (let ((pp-default-function #'pp-fill)
> (fill-column 8))
> (pp '(x. y. z.)))
>
> yields output that is not the same expression as the input:
>
> (x. y
> . z.)
>
> When the `fill-column' is smaller (or there are more elements in input) the yielded value is not a valid s-expression
>
> (let ((pp-default-function #'pp-fill)
> (fill-column 5))
> (pp '(x. y. z.)))
>
> yields:
>
> (x
> . y
> . z.)
>
> Trying to `read' it back:
> (read
> (let ((pp-default-function #'pp-fill)
> (fill-column 5))
> (pp '(x. y. z.))))
>
> Yields the following error:
>
> Debugger entered--Lisp error: (invalid-read-syntax "expected )")
> read("(x\n . y\n . z.)\n")
> (progn (read (let ((pp-default-function #'pp-fill) (fill-column 5)) (pp '(x. y. z.)))))
> eval((progn (read (let ((pp-default-function #'pp-fill) (fill-column 5)) (pp '(x. y. z.))))) t)
> elisp--eval-last-sexp(nil)
> #f(compiled-function () #<bytecode 0x518641632d4e2>)()
> handler-bind-1(#f(compiled-function () #<bytecode 0x518641632d4e2>) (error) eval-expression--debug)
> eval-last-sexp(nil)
> funcall-interactively(eval-last-sexp nil)
> call-interactively(eval-last-sexp nil nil)
> command-execute(eval-last-sexp)
>
> For comparison the `pp-29' yields correct output (it's `fill-column' insensitive, hence omitted in the example):
>
> (let ((pp-default-function #'pp-29))
> (pp '(x. y. z.)))
>
> yields (I guess) exepcted output:
>
> (x. y. z.)
>
> For a real life error, please see: https://github.com/purcell/package-lint/issues/285
Stefan, any comments or suggestions?
This bug report was last modified 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.