4 ms·
Paredit changed the way I write Common Lisp, and I personally consider it a sort of killer feature of developer experience. Combined with canonical indentation
by reikonomusha 4y ago
Paredit changed the way I write Common Lisp, and I personally consider it a sort of killer feature of developer experience. Combined with canonical indentation of Lisp code (where every line can be indented in essentially just a single correct way, determined automatically by the editor), editing Lisp code actually becomes one of the most pleasurable of activities in programming. When you go back to editing Python, JavaScript, or C—even with a slick IDE—it just feels like a DX regression.
- llanowarelves 4y agoWhat are you using for the indentation? Does Emacs just do it automatically? I was looking for the equivalent of Prettier for Lisp/Scheme and didnt really find anything.
- DEFEC8ED 4y agoIn general, the answer is yes, but it depends on the major mode providing the functions necessary for code formatting. I'm not exactly sure what this looks like for Lisps, but I'd guess most of these functions are provided by SMIE (https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html https://www.gnu.org/software/emacs/manual/html_node/elisp/SM...). There are built in minor modes such as electric-indent-mode that indent automatically, but I personally use aggressive-indent-mode.
- reikonomusha 4y agoEmacs (and SLIME) do it automatically. I have some very, very light customization to change indentation for a couple cases (aligning keyword arguments, indenting MAKE-INSTANCE, etc).
- elwell 4y agoEmacs aggressive-indent-mode
- slyrus 4y agoorg mode with paredit for the lisp source blocks is a life changer! but it does highlight the deficiencies of other languages (and their editors) when one has to write/edit R, python, etc... Then again, being able to do so in the same file is a major win.
- bmitc 4y agoIs there a particular tutorial or method you followed to be fluent with Paredit. I like Lisp/Scheme but have never adopted any of the tools like Paredit or Parinfer but would be interested in doing so.
- capableweb 4y agoSeeing as you mix Lisp and Scheme together, I'm guessing you're not aiming for a specific language? If so, Calva (VS Code plugin for Clojure) has a visual guide for how to use Paredit via Calva: https://calva.io/paredit/ https://calva.io/paredit/ Even if you don't use VS Code/Clojure specifically, the "Action" names should be the same or similar with other Paredit extensions, so you can become familiar. Best advise I have for learning Paredit is doing the same as you would if you were to learn Vim: Every time you think "How can I do X faster?" look up the way to do it and write it down on a cheatsheet. After a couple of times it'll become muscle memory.
- bmitc 4y agoThanks! I’ll take a look at the Calva tutorial. I’m currently not really all in on a Lisp/Scheme, as you deduced, but Racket is my usual Lisp/Scheme goto. But I’m open to using Clojure to learn.
- fiddlerwoaroof 4y agoWhat made a difference for me was figuring out the right keybindings. The default keybindings in emacs weren’t very ergonomic and so I came up with a more convenient set of keybindings (for evil-mode, since I prefer vim-style editing). They follow a nice pattern on the keyboard and made a huge difference. I eventually adapted them so I could have relatively consistent keybindings across vim/emacs/VSCode/IntelliJ and the results are here: https://github.com/fiddlerwoaroof/dotfiles/blob/b13240a42fa4413916ddacac62eb767f102df8c0/emacs.d/lisp/configurations/evil-conf.el#L127 https://github.com/fiddlerwoaroof/dotfiles/blob/b13240a42fa4... If you understand the elisp keybinding notation, it’s possible to use the C-, ones in VSCode.
- geospeck 4y agoWhen I started using Paredit I found "The Animated Guide to Paredit"[1] very helpful. It basicaly demonastrates some of the most useful commands in short videos. [1]http://danmidwood.com/content/2014/11/21/animated-paredit.html http://danmidwood.com/content/2014/11/21/animated-paredit.ht...
- emmelaich 4y agoA revelation for me was doing a Racket course and seeing the style with the ending parens all on one line. Made so much more sense than matching up with the opening paren by indentation. One of the first lisps I used let you use a super-closing ] instead of umpteen ))). That sort of made sense to me too.