emacs-devel
[Top][All Lists]
Advanced

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

Re: 2a73673 Change how thread-first/thread-last indent the first argumen


From: Adam Porter
Subject: Re: 2a73673 Change how thread-first/thread-last indent the first argument
Date: Tue, 05 Oct 2021 03:41:20 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Adam Porter <adam@alphapapa.net> writes:
>
>> In this commit, you changed the thread-last macro's indentation from
>> (indent 1) to (indent 0).
>
> The change made the macro indent the way it was documented to indent (in
> the doc string):
>
>   "Thread FORMS elements as the first argument of their successor.
> Example:
>     (thread-first
>       5
>       (+ 20)
>       (/ 25)
>       -
>       (+ 40))

It would only be a two-character, whitespace-only change to "fix" the
docstring.  ;)

>> Could this be reverted, please?  This change
>> has two drawbacks:
>>
>> 1.  The threaded form is no longer indented differently from the other
>> forms, so it no longer stands out.
>
> I don't really have an opinion here -- I can revert the change if that's
> what people that use the macro wants.  It just looked really wrong to me
> to indent the first element specially, but I don't use these macros in
> Emacs.  I don't think ->> indents the first element specially in
> Clojure, for instance?  (At least I don't remember them doing so.)

You're right about Clojure.  And, in fact, Dash.el does follow Clojure
there in its implementation of `->>', et al.  However, earlier this
year, Basil adjusted its indentation to be in line with how
`thread-last' used to indent, with the first form indented more:

https://github.com/magnars/dash.el/pull/375

And perhaps ironically, it was me who convinced him to revert that
change and restore the Clojure-like indentation.  My reasoning was the
same as my second reason posted here: it results in lots of whitespace
churn downstream.

At the same time, I agree with Basil that we need not follow Clojure's
conventions, and using first-form indentation is more useful.

Another issue is that, since older Emacs versions persist in the wild
for years, this will result in code changing indentation between Emacs
versions: if someone submits a patch based on Emacs <28, it will have
one indentation, and if the maintainer uses Emacs 28, it will have
another indentation.

Finally, changing the indentation will break indentation linters.  For
example, in https://github.com/alphapapa/makem.sh I use the lint-indent
rule to ensure that code is correctly indented, and I test some of my
packages on multiple Emacs versions in CI.  This change will cause
linting to always fail on one Emacs version or another, so it won't be
possible to have a clean linting anymore.

So if this were reverted, I'd be grateful.




reply via email to

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