bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68403: 29.1.90; Adaptive fill in Elisp docstrings


From: Psionic K
Subject: bug#68403: 29.1.90; Adaptive fill in Elisp docstrings
Date: Sun, 21 Jan 2024 13:31:54 +0900

Do I need to report anything else?

The decision to preserve indentation of the opening double quote of Elisp docstrings is a bug.

On Sat, Jan 13, 2024 at 12:41 PM Psionic K <psionik@positron.solutions> wrote:
> 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.


--

남백호
대표 겸 공동 창업자
포지트론

reply via email to

[Prev in Thread] Current Thread [Next in Thread]