Subject: Re: bug#68403: 29.1.90; Adaptive fill in Elisp docstrings

From: Psionic K <[email-masked]>
Date: Sat, 13 Jan 2024 12:41:19 +0900

> I wonder why you say this started only about a month ago

> same behavior in Emacs 29.1 and in Emacs 28.2

It's safe to assume there was a coincidence with my workflow changing.
I switched structural editing packages and began producing only closed
strings.  Further exploration of the behavior revealed this to cause a
significant rise in instances of inconsistent indentation.

Below is another reproduction example that is consistent in 28.2 and
29.1.90.  Open and closed strings differ in their auto-filling on the
second line.

With a closed string, the filling will unindent the first newline:

(defun hello ()
  "asklf a;slfj al;sfj akl;sfj ;alsj f;asj f;aslfj a;lsjf;alksj df;ajs
f asfal;sfj al;sjfl;aksj fl;as afa  asfaskf al;sjfl;af ;lasj df;lajf
  ;asdflj asl;dfj a;sjf ;aldfj;alsdfjk a;sdfj a;sdfjlk "
  (message "nice"))

With an open string (no closing double quote) the filling comes out like this:

(defun hello ()
  "asldkfj al;sdjf l;asjf l;asj fl;ja sl;dfj al;sfj l;asjdfl;aj fl;aj
  flj al;jf alj fl;kajsdl;fj al;sf ;alfl;kaj sfkl;ajsfklj askl;fj
  akl;sj fakl;js fkl;aj sdfkl;ja sl;d aj;sldkf jasl;fj al;sdfal;ksdf
  akl;sdjf;laj s;dlfjk ;l
  (message "nice"))

While adaptive fill mode appears intended to allow new paragraphs to
retain the indentation throughout the paragraph, the calculation of
indentation for the first paragraph for docstrings in Elisp results in
erroneous and inconsistent indentation for the first paragraph.  The
docstring's first line indentation is structurally part of the
s-expression, not part of the docstring.

> Do you indeed see that auto-fill-mode in a .el file does NOT produce two-space indentation, under the default value of adaptive-fill-mode

With adaptive-fill-mode t, the default, both 28.2 and 29.1.90 produce
two space indentation.  Both versions, with adaptive-fill-mode nil
produce no indentation.  Both versions exhibit the above difference
for open and closed docstrings.