emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp code formatting


From: Campbell Barton
Subject: Re: Emacs Lisp code formatting
Date: Thu, 4 Nov 2021 17:51:44 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1

On 11/4/21 16:47, Lars Ingebrigtsen wrote:
Campbell Barton <ideasman42@gmail.com> writes:

You could scan external `require' calls, but this means parsing many
files to extract the information you need.

Like with indentation, I think we can assume that the source has been
loaded.

Not sure what you mean exactly, while developing packages functions/macros may change, so I don't think it's reasonable to assume the evaluated state in emacs has loaded into memory is up to date. In general it may be useful to auto-format code that hasn't been evaluated too.

Note that I use auto-format on save for all my packages (full
auto-formatting, not just auto-indent), and personally find it great,
but as far as I know I'm the only person doing this.

I think auto-formatting would be a more complicated thing than a pp for
code -- it would need to preserve comments, for instance.  A pp for code
doesn't have to worry about things like that.

For sure, even so, I think getting an initial auto-formatter working is a weekend project, getting all the details figured out is a bigger task though.

I get the impression most elisp developers prefer to manually format their code and use auto-indentation.

Auto formatters are becoming more popular in other languages though, clang-format (C/C++), black (for Python)... once you're used to running them automatically on save, it feels like a step backwards not to have this feature available.



reply via email to

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