all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* autoformat (like clang-format) elisp code?
@ 2022-03-17  9:15 Juan José García-Ripoll
  2022-03-17  9:44 ` Óscar Fuentes
  2022-03-17 22:19 ` Michael Heerdegen
  0 siblings, 2 replies; 7+ messages in thread
From: Juan José García-Ripoll @ 2022-03-17  9:15 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I know this is a very opinionated topic, but I have become used to
clang-format in my C++ projects as a tool that automatically formats
_all_ of my code, without me thinking much about it.

Is there a way to enable Emacs do this for Emacs lisp files? The idea is
that, as in clang-format, one can specify a stype (e.g. GNU in this
case) and let the software handle indentation, wrapping and formatting
on save (not necessarily while editing).

Cheers,

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-17  9:15 autoformat (like clang-format) elisp code? Juan José García-Ripoll
@ 2022-03-17  9:44 ` Óscar Fuentes
  2022-03-17 10:06   ` Juan José García-Ripoll
  2022-03-17 22:19 ` Michael Heerdegen
  1 sibling, 1 reply; 7+ messages in thread
From: Óscar Fuentes @ 2022-03-17  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

Juan José García-Ripoll <juanjose.garciaripoll@gmail.com> writes:

> Hi,
>
> I know this is a very opinionated topic, but I have become used to
> clang-format in my C++ projects as a tool that automatically formats
> _all_ of my code, without me thinking much about it.
>
> Is there a way to enable Emacs do this for Emacs lisp files?

Maybe aggressive-indent? I use it with great success for lisp-like
languages. However, I also use paredit, which means that there are no
unbalanced parens at any time.

https://github.com/Malabarba/aggressive-indent-mode




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-17  9:44 ` Óscar Fuentes
@ 2022-03-17 10:06   ` Juan José García-Ripoll
  2022-03-17 12:14     ` Óscar Fuentes
  0 siblings, 1 reply; 7+ messages in thread
From: Juan José García-Ripoll @ 2022-03-17 10:06 UTC (permalink / raw)
  To: help-gnu-emacs

Both electric and aggressive indent fail to address other issues, such
as line wrapping in comments and code, possible alignment of variables,
etc. Am I wrong?

Óscar Fuentes <ofv@wanadoo.es> writes:
> Juan José García-Ripoll <juanjose.garciaripoll@gmail.com> writes:
>
>> Hi,
>>
>> I know this is a very opinionated topic, but I have become used to
>> clang-format in my C++ projects as a tool that automatically formats
>> _all_ of my code, without me thinking much about it.
>>
>> Is there a way to enable Emacs do this for Emacs lisp files?
>
> Maybe aggressive-indent? I use it with great success for lisp-like
> languages. However, I also use paredit, which means that there are no
> unbalanced parens at any time.
>
> https://github.com/Malabarba/aggressive-indent-mode
>
>
>

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-17 10:06   ` Juan José García-Ripoll
@ 2022-03-17 12:14     ` Óscar Fuentes
  0 siblings, 0 replies; 7+ messages in thread
From: Óscar Fuentes @ 2022-03-17 12:14 UTC (permalink / raw)
  To: help-gnu-emacs

Juan José García-Ripoll <juanjose.garciaripoll@gmail.com> writes:

> Both electric and aggressive indent fail to address other issues, such
> as line wrapping in comments and code, possible alignment of variables,
> etc. Am I wrong?

aggressive-indent has a customization for comments:


aggressive-indent-comments-too is a variable defined in ‘aggressive-indent.el’.

Its value is nil

If non-nil, aggressively indent in comments as well.


Dunno how well it works.

As for aligment of variables and etc, I *think* that whatever formatting
M-x indent-region does aggressive-indent will do the same.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-17  9:15 autoformat (like clang-format) elisp code? Juan José García-Ripoll
  2022-03-17  9:44 ` Óscar Fuentes
@ 2022-03-17 22:19 ` Michael Heerdegen
  2022-03-25  9:43   ` dal-blazej
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Heerdegen @ 2022-03-17 22:19 UTC (permalink / raw)
  To: help-gnu-emacs

Juan José García-Ripoll <juanjose.garciaripoll@gmail.com> writes:

> Hi,
>
> I know this is a very opinionated topic, but I have become used to
> clang-format in my C++ projects as a tool that automatically formats
> _all_ of my code, without me thinking much about it.

In theory, pp.el.  Lars has introduced `pp-emacs-lisp-code', but it's
only a stub, somebody has to work on it.

Apart from that, only partial and very limited solutions exist AFAIK.

Michael




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-17 22:19 ` Michael Heerdegen
@ 2022-03-25  9:43   ` dal-blazej
  2022-03-25 23:19     ` Michael Heerdegen
  0 siblings, 1 reply; 7+ messages in thread
From: dal-blazej @ 2022-03-25  9:43 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

Auto-formatting is a feature of the package lispy.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoformat (like clang-format) elisp code?
  2022-03-25  9:43   ` dal-blazej
@ 2022-03-25 23:19     ` Michael Heerdegen
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Heerdegen @ 2022-03-25 23:19 UTC (permalink / raw)
  To: help-gnu-emacs

dal-blazej@onenetbeyond.org writes:

> Hi,
>
> Auto-formatting is a feature of the package lispy.

Hi.

How does it do that?  Does it do a better job than pp.el?

Thanks,

Michael.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-25 23:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-17  9:15 autoformat (like clang-format) elisp code? Juan José García-Ripoll
2022-03-17  9:44 ` Óscar Fuentes
2022-03-17 10:06   ` Juan José García-Ripoll
2022-03-17 12:14     ` Óscar Fuentes
2022-03-17 22:19 ` Michael Heerdegen
2022-03-25  9:43   ` dal-blazej
2022-03-25 23:19     ` Michael Heerdegen

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.