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

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

Re: on adding a function call to a s-exp


From: João Távora
Subject: Re: on adding a function call to a s-exp
Date: Tue, 12 Jun 2018 18:16:34 +0100

On Tue, Jun 12, 2018 at 6:04 PM, Óscar Fuentes <ofv@wanadoo.es> wrote:

> João Távora <joaotavora@gmail.com> writes:
>
> [...]
>
> It is true that paredit is irritating sometimes, but very convenient
> otherwise.
>
> For the benefit of those who don't know it, let's put a simple example.
> Suppose that you have:
>
> (foo)
> (bar)
>
> but now you wish to wrap those function calls inside a conditional. So
> you write:
>
> (when something
> (foo)
> (bar))
>
> Which requires moving the cursor through several lines just to add a
> parenthesis.
>
> With paredit, you write
>
> (when something_)
> (foo)
> (bar)
>
> (the underscore represents the position of the cursor). Now you can
> incorporte the function calls inside the `when' with
> paredit-forward-slurp-sexp.
>

In electric-pair-mode, you C-M-SPC C-M-SPC ( w h e n SPC s o m e ...

this gets you the same thing, with the advantage that if you hold
C-M you type SPC twice, and with the advantage that you've typed
only ancient primitive Emacs commands.


> Things like this, combined with aggressive-indent-mode, makes editing
> Lispy languages quite pleasant, IMHO. In the past I worked like Drew
> describes, which is fine, but now I need to worry less about putting the
> parens on the right place. Paredit does that for me.


I'm just saying that electric-pair-mode will do that for you without
the annoyances or the extra brain space required to learn "slurps".

But even now, you can enjoy your paredit-.*-slurp commands
with electric-pair-mode: just don't turn on paredit-mode. Then
you have the best of both worlds.

I use aggressive-indent-mode too, btw. It's very nice... but very
aggressive too.

-- 
João Távora


reply via email to

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