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

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

bug#9622: [PATCH] Re: bug#9622: 23.3; flet indentation


From: akater
Subject: bug#9622: [PATCH] Re: bug#9622: 23.3; flet indentation
Date: Sat, 09 Oct 2021 07:26:04 +0000

Lars Ingebrigtsen <larsi@gnus.org> writes:

> akater <nuclearspace@gmail.com> writes:
>
>> I don't think so.  The first attempt was written in a hurry, and merged
>> without extensive testing; in the second I did exhaustive tests, it just
>> never crossed my mind to test on unbalanced expressions.  This very much
>> looks like the last ignore-errors of them:
>
> Thanks, but I think we're just too late to get this into Emacs 28, so I
> resurrected your patch series and pushed it as one patch to the trunk.
> (I also added all the test cases from your second patch to ert.)
>
> Please have a look and see if I missed something when I did the merge.

Everything from my last patch is in its place (my branch is even with
master, and 15 tests are there) but:

We need to also include partial sexps, and a test should ensure RET brings
point to the proper position.  I have not familiarized myself with this test
routine yet so I'm not sure how to do this right.  The important aspect I want
to point out now is, especially since previous partial sexps affect the
indentation of all consequent sexps, we must ensure this will not affect both
the “RET tests” and tests where the region is indented.  This presumes all our
test cases will reside in a single file but they should be because otherwise it
will be terrible.  This is important enough so I write this message in advance
even though the indentation is sometimes wrong and I've not yet figured it out.

Here go “RET test cases”; looks like they are exhaustive, modulo variations
with longer excessive whitespace.  Not everything of what follows is indented
correctly with my patch.  I'm investigating; some issues might be present even
without my patch.

In what follows, ^ points to the appropriate position after RET is pressed.

The last case that broke my patch:
(let ((x (and y

              ^
A variation of it, just in case:
(let ((x

       ^
; N.B.: This is the way it is in elisp-mode right now but in lisp-mode, the 
point is one step further.

5 cases with some whitespace missing:

flet-missing-whitespace-1
(cl-flet((f (x)

           ^
flet-missing-whitespace-2
(cl-flet((f(x)

           ^
flet-missing-whitespace-3
(cl-flet ((f(x)

            ^
flet-missing-whitespace-4
(cl-flet( (f (x)

            ^
flet-missing-whitespace-5
(cl-flet( (f(x)

            ^

Combinations of missing and excessive whitespace

flet-missing-and-excessive-whitespace-1
(cl-flet((f  (x)

           ^
flet-missing-and-excessive-whitespace-2
(cl-flet  ((f(x)

             ^
flet-missing-and-excessive-whitespace-3
(cl-flet( (f  (x)

            ^
flet-missing-and-excessive-whitespace-4
(cl-flet(  (f (x)

             ^
flet-missing-and-excessive-whitespace-5
(cl-flet(  (f  (x)

             ^
flet-missing-and-excessive-whitespace-6
(cl-flet(  (f(x)

             ^

There's another problem: in some of these cases, even though initial
indentation is incorrect, once the sexp is completed, it is indented correctly.
But in some other cases, it's not!  I'm looking into this.

Attachment: signature.asc
Description: PGP signature


reply via email to

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