3 ms·
There's a structured editing mode for Emacs called Paredit, to use for s-expression languages like Lisp, Racket, Clojure. Since the AST for such languages is s
by 6cxs2hd6 13y ago
There's a structured editing mode for Emacs called Paredit, to use for s-expression languages like Lisp, Racket, Clojure.
Since the AST for such languages is s-expressions, and some people struggle with parens, this is an interesting "fun size" example of editing the AST.
The thing is, paredit is quite challenging for most people to adopt, due to what you mentioned about the "flow" they've already learned. Magnar Sveen has a great video about this at http://www.youtube.com/watch?v=D6h5dFyyUX0 http://www.youtube.com/watch?v=D6h5dFyyUX0
Best quote: "If you think paredit is not for you, then you need to become the kind of person that paredit is for."
EDIT: To clarify, Magnar is quoting technomancy a.k.a. Phil Hagelberg.
- MBlume 13y agoAvailable for vim as well. This is one of the things that consistently makes my life better. http://www.vim.org/scripts/script.php?script_id=3998 http://www.vim.org/scripts/script.php?script_id=3998
- calibraxis 13y agoYes, Paredit's not really a straitjacket, but your editor having new concepts — verbs which operate on code units. It overrides some deletion commands to maintain your code well-formed, but there's simple ways (like cutting text) to break those rules, so it's ill-formed. (Currently, paredit won't start if it sees you're editing ill-formed text. But if it's already started, it'll continue running.)
- 6cxs2hd6 13y agoRight, I realize it's not an inescapable straitjacket, and I'm definitely not putting down paredit; upvoted your comment. I mention it because it's an example of structured editing of an extremely simple AST. And even people who want to use it (who want to leverage the so-called "straitjacket"), often find it quite hard to change their flow and adapt it. That seems not to bode well for this being enthusiastically used generally. OTOH I suppose you could argue that a lot of people like auto-completing IDEs, and/or hate to type, so who knows.