Re:Show HN: Parinfer – a simpler way to write Lisp
by msbarnett on Wednesday November 11, 2015 @01:20PM
(#10548186)
This reminds me more of Paredit, in that it handles s-expression aware source transformations, and not just indentation:
http://emacsrocks.com/e14.html
I would deeply love to see this kind of inference engine ported to emacs as an alternative to Paredit's chords
Re:Show HN: Parinfer – a simpler way to write Lisp
by ruricolist on Wednesday November 11, 2015 @04:43PM
(#10549544)
A more direct comparison for Emacs would be `adjust-parens`:
Re:Show HN: Parinfer – a simpler way to write Lisp
by alphapapa on Thursday November 12, 2015 @02:30AM
(#10551798)
Wow! This is fantastic! This seems to do just what Parinfer does. Why isn't this mode more well-known?
This makes it even better:
(defun my/lisp-dedent-adjust-parens ()
(interactive)
(save-excursion
(x4-smarter-beginning-of-line)
(call-interactively 'lisp-dedent-adjust-parens)))
(defun my/lisp-indent-adjust-parens ()
(interactive)
(save-excursion
(x4-smarter-beginning-of-line)
(call-interactively 'lisp-indent-adjust-parens)))
(local-set-key (kbd "<M-left>") 'my/lisp-dedent-adjust-parens)
(local-set-key (kbd "<M-right>") 'my/lisp-indent-adjust-parens)
Now you can just M-left and M-right to adjust the indentation of any line, regardless of where the point is, and adjust-parens fixes the parens for you.
https://github.com/Malabarba/aggressive-indent-mode