all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Campbell Barton <ideasman42@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs Lisp code formatting
Date: Thu, 4 Nov 2021 11:31:40 +1100	[thread overview]
Message-ID: <b29c65fb-6f0b-e727-b4e1-4faa9c2ec374@gmail.com> (raw)
In-Reply-To: <87y264kcza.fsf@gnus.org>

On 11/4/21 10:59, Lars Ingebrigtsen wrote:
> Campbell Barton <ideasman42@gmail.com> writes:
> 
>> There are a handful of 3rd party lisp formatting tools [0], though, YMMV.
>>
>> [0]: https://emacs.stackexchange.com/a/55759/2418
> 
> Thanks.  I had a look at them, but they seem to have the problem of
> being 1) too dependent on the rest of a larger package or 2) having
> special code for known constructs (meaning that there'd be a maintenance
> burden over the years).
> 
> I wonder how far one can get by using the symbol properties (i.e.,
> edebug-form-spec/lisp-indent-function/doc-string-elt).  Has anybody
> looked into that?  If not, I think I'll take a whack at implementing
> something simple based on that -- it seems like it should be possible to
> make something general based on that.

You could get quite far, an issue I ran into is function introspection 
such as `func-arity' depend on the code being loaded into emacs.

You could scan external `require' calls, but this means parsing many 
files to extract the information you need.
If you're OK with loading the code for the purpose of introspection - 
you could spawn an emacs instance for that purpose.
If speed is important (such as running this whenever saving a file) the 
information could be cached (with a file list to detect when the cache 
needs to be regenerated).

This is the main sticking point for me, something that would need to be 
resolved before auto-formatting could be recommended for general use.

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.



  reply	other threads:[~2021-11-04  0:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 15:27 Emacs Lisp code formatting Lars Ingebrigtsen
2021-11-02 23:31 ` Campbell Barton
2021-11-03 23:59   ` Lars Ingebrigtsen
2021-11-04  0:31     ` Campbell Barton [this message]
2021-11-04  5:47       ` Lars Ingebrigtsen
2021-11-04  6:51         ` Campbell Barton
2021-11-04  8:39           ` Helmut Eller
2021-11-04 16:51           ` Lars Ingebrigtsen
2021-11-04 23:34 ` Lars Ingebrigtsen
2021-11-06 19:01   ` Juri Linkov
2021-11-06 21:34     ` Lars Ingebrigtsen
2021-11-07 17:27       ` Juri Linkov
2021-11-07 21:06         ` Lars Ingebrigtsen
2021-11-08  8:59           ` Juri Linkov
2021-11-08  9:06             ` Lars Ingebrigtsen
2021-11-07  1:37   ` Michael Heerdegen
2021-11-07  1:45     ` Lars Ingebrigtsen
2021-11-07  2:22       ` Michael Heerdegen
2021-11-07  2:47         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b29c65fb-6f0b-e727-b4e1-4faa9c2ec374@gmail.com \
    --to=ideasman42@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.