emacs-devel
[Top][All Lists]
Advanced

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

Re: parinfer-mode for Emacs might be neat for encouraging Lisp adoption


From: Marcin Borkowski
Subject: Re: parinfer-mode for Emacs might be neat for encouraging Lisp adoption
Date: Fri, 13 Nov 2015 16:57:17 +0100
User-agent: mu4e 0.9.15; emacs 25.0.50.1

On 2015-11-13, at 16:34, João Távora <address@hidden> wrote:

> Hi Oleh, Christopher, Marcin
>
> What do you think of this prototype?
>
>     (defun joaot/setup-some-parinfer-fanciness ()
>       (add-hook 'post-self-insert-hook 'joaot/reindent-up 'append 'local))
>
>     (add-hook 'lisp-mode-hook 'joaot/setup-some-parinfer-fanciness)
>
>     (defun joaot/reindent-up ()
>       (ignore-errors
>         (save-excursion
>           (backward-up-list) (indent-sexp))))
>
> Now in some lisp-mode, type
>
>    (defun parinfer ()
>      (let ((foo bar)
>            (baz quux))))
>
> Change the `let' to `let*' and watch the auto-reindentation
> magic. Probably very slow, but a cool trick nonetheless right?

I'll try it later!

> This is useful is other languages, right? Couldn't JSON benefit from
> something like this too?
>
>> - It doesn't solve the problem of pasting unbalanced code.
>
> IMO the problem of pasting unbalanced code is best solved by leaving it
> alone, and using `electric-pair-mode's paren-balancing heuristic (on by
> default), which is like paredit, but without the restraining order. And
> no need to learn new commands.

BTW, lispy's M command also (kind of) solves that.

> Have you tried it, Oleh? Any feelings on how it could be improved?
>
> Works for every language defining one or multiple parenthesis
> syntaxes. Just like the hack above.
>
> Personally I haven't tried lispy, basically because I want uniform
> interfaces for all languages, even non-programming ones. I don't want to
> re-learn shortcuts when I switch from lisp to JSON.
>
> For that, I stick to, and am reasonably happy with, traditional sexp
> navigation, the C-M-* family of movement/edition commands. Whoever came
> up with those deserves some love.

That is also a good point.  (But I use lispy nevertheless.)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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