-
-
Couldn't load subscription status.
- Fork 143
lispy multiline
lispy-alt-multiline can be used on a LISP expression to re-format it across multiple lines.
This has to be done with some rules, since a one-line expression can transform to multiple viable multi-line forms. So far, these rules are implemented by customizing these variables:
(defvar lispy--multiline-take-3 '(defvar defun defmacro defcustom defgroup) "List of constructs for which the first 3 elements are on the first line.") (defvar lispy--multiline-take-2 '(defface define-minor-mode condition-case while incf car cdr > >= < <= eq equal incf decf cl-incf cl-decf catch require provide setq cons when if unless interactive) "List of constructs for which the first 2 elements are on the first line.")There's actually a family of commands available:
-
lispy-alt-multilineis bound to T -
lispy-multilineis bound to M -
lispy-onelineis bound to O
All of these apply to the current expression. To be really sure which one, turn on show-paren-mode. You can also call these functions not from special, although this isn't very convenient.
The difference between M and T is that M is older and ad-hoc, while T is newer and rule-based. This means that the latter can misbehave, since it's not yet fully tested. However, it has the following built-in check to make sure that it doesn't mess up your code:
The
readexpression before transformation should beequalto thereadtransformed expression
If the above check fails, no change will be performed on the source code.
In the following image, I just press T once, starting from an unchanged buffer:
