Subject: Re: bug#31984: 26.1.50; IELM doesn't indent results printed with #

From: Noam Postavsky <[email-masked]>
Date: Wed, 27 Jun 2018 22:01:34 -0400

retitle 31984 26.1; indent-sexp doesn't indent expressions starting with #
found 31984 26.1
tags 31984 + confirmed
quit

Gemini Lasswell <[email-masked]> writes:

> When the result of evaluation in IELM is something with a printed
> representation beginning with #, such as a record or char-table,
> it is pretty-printed without indentation.
>
> To reproduce, M-x ielm RET and then evaluate this:
>
> (require 'cl-lib)
> (cl-defstruct (foo) a)
> (make-foo :a (lambda (x) (- 1 x)))
>
> Result:
>
> #s(foo :a
> (lambda
> (x)
> (- 1 x)))

Which is because pp-buffer doesn't indent this, which is because
indent-sexp doesn't indent it, which is because indent-sexp now relies
on forward-sexp to find the end, and forward-sexp only goes over the
"#s".

Another example:

With point before the (foo), Emacs 25 indent-sexp turns this

(foo) (blah
etc)

into this

(foo) (blah
       etc)

Emacs 26 indent-sexp doesn't do anything from that position.  It's less
clear which is correct in that case, but restoring to the Emacs 25
behaviour would fix the #s(...) case as well.  Alternatively, we could
fix elisp sexp movement to handle such expressions, which we should
probably do anyway (see also Bug#15998).