[HN Gopher] Paredit 25 released, after 8 years
       ___________________________________________________________________
        
       Paredit 25 released, after 8 years
        
       Author : salutis
       Score  : 181 points
       Date   : 2022-11-26 11:57 UTC (11 hours ago)
        
 (HTM) web link (paredit.org)
 (TXT) w3m dump (paredit.org)
        
       | billfruit wrote:
       | Anyone with experience of both paredit and smartparens, which
       | would you recommend?
        
         | philjackson wrote:
         | I can't live without smartparens-strict-mode - how do people
         | edit lisp without it?!
        
       | pbiggar wrote:
       | Paredit is so good - completely changes how you edit. It was also
       | the primary influence for making the Darklang editor a structured
       | editor, though I confess it is not yet as good as paredit.
        
       | tym0 wrote:
       | Do people have any tips on getting started with paredit in vim?
       | I'm pretty happy with Parinfer but it sometimes makes working
       | with other people's code painful...
        
         | susam wrote:
         | I have a small section dedicated to Paredit in my _Lisp in Vim_
         | post: https://susam.net/blog/lisp-in-vim.html
         | 
         | Direct link to the Paredit section:
         | https://susam.net/blog/lisp-in-vim.html#get-started-with-par...
         | 
         | This section introduces only the most basic features like
         | electric returns, regathering, slurping, barfing, etc. For a
         | complete documentation of all the features, it is worth
         | entering :help paredit-keys directly in Vim. The help manual is
         | not too long. Takes about 30 to 40 minutes to read through it
         | and try some of the commands that look interesting.
        
       | perihelions wrote:
       | Is it worth trying to make a serious effort with things like
       | paredit, if you're already happy with default Emacs lisp modes? I
       | feel like they're already overpowered.
       | 
       | When I last tried this, I felt like I was struggling against the
       | mode's understanding of my syntax, more than it was assisting me.
       | I didn't figure out how to "think" in its language. I want to
       | know if I'm missing out on something wonderful, or if it's more
       | of a "just another tool, don't worry about it".
        
         | Barrin92 wrote:
         | I would consider myself a fairly unserious paredit user and I
         | still think it's immensely useful. The things I use most of the
         | time are really just barf, slurp and splice yet it makes so
         | much more sense to me now to think of S-expressions
         | structurally rather than just editing text.
         | 
         | Both the advantage and disadvantage of lisp are its lack of
         | structure and paredit forcing you to keep your code intact
         | really prevents a ton of issues just by having it on.
        
         | lgas wrote:
         | I think it is worth it. Mastering it was one of the first times
         | I felt like I had gained a programming power up. It's
         | definitely a little awkward at first but if you keep at it,
         | eventually the switch will flip and you'll wonder how you
         | could've lived without it.
        
         | Athas wrote:
         | Paredit is so good that even after taking a break from Lisp for
         | years, as soon as I opened up an .el file to do some Emacs
         | customisation, the muscle memory was fully intact and I was
         | able to perform structural edits without even thinking about
         | which keys I pressed. I try not to write too much Lisp these
         | days, because I inevitably become depressed at how clumsy it is
         | to manipulate syntax in the languages I use more commonly.
        
         | ahmedalsudani wrote:
         | Paredit made a massive difference when I was writing Lisp. It
         | does take some getting used to, but pretty sure it was a net
         | positive after a week of use.
         | 
         | I actually started enabling it when writing other languages
         | (Python/C++) to see if it could do its magic there.
        
           | the-lazy-guy wrote:
           | You probably know that, but there is smartparens mode which
           | does similar magic to non-lisp languages:
           | https://github.com/Fuco1/smartparens
        
       | reikonomusha wrote:
       | 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.
        
         | slyrus wrote:
         | org 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.
        
         | llanowarelves wrote:
         | What 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 wrote:
           | In 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://w
           | ww.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.
        
           | elwell wrote:
           | Emacs aggressive-indent-mode
        
           | reikonomusha wrote:
           | Emacs (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).
        
         | bmitc wrote:
         | Is 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 wrote:
           | Seeing 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/
           | 
           | 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 wrote:
             | Thanks! 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.
        
         | emmelaich wrote:
         | A 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.
        
       | bongobingo1 wrote:
       | Am I stupid or does this not say what it does anywhere on the
       | site or repo.
       | 
       | E: https://www.emacswiki.org/emacs/ParEdit
        
         | qorrect wrote:
         | It's on the first line there _" ParEdit (paredit.el) is a minor
         | mode for performing structured editing of S-expression data.
         | The typical example of this would be Lisp or Scheme source
         | code."_ You'd have to known emacs nomenclature ( minor-mode )
         | and Lispy words ( S-expression )
        
           | nulbyte wrote:
           | I assume E: is for edit. I think GP was pointing out that the
           | ParEdit website doesn't offer much in the way of explanation,
           | and later found another site that did.
        
         | srcreigh wrote:
         | If you click paredit.el, there's prose explanation in the
         | comments.
        
       | iainctduncan wrote:
       | Can anyone tell me if it's as helpful for Scheme? Thx!
        
       | salutis wrote:
       | Also, Paredit now has a public website and repository.
        
         | agumonkey wrote:
         | back in the days, all there was was
         | http://pub.gajendra.net/src/paredit-refcard.pdf
        
         | tsuru wrote:
         | Congrats! And thank you! This changed my lisp experience and my
         | wishlist for interacting with non-s-exp code when I found it
         | years ago.
        
           | capableweb wrote:
           | Same here. After getting used to the "automatic" way of
           | editing and writing s-expressions, I can't believe something
           | similar doesn't exists for the C-like code most people write
           | today, but then I remember how much syntax all those
           | languages really contain. Rust is like a trivia answer for
           | "How much syntax could you possibly put into one language?".
        
             | bhrgunatha wrote:
             | Here's hoping that type of structured movement and editing
             | will spread much wider now tree-sitter is merged into emacs
             | master. Already quite a few parsers/grammars available for
             | tree sitter:
             | 
             | https://tree-sitter.github.io/tree-sitter/#available-
             | parsers
        
             | Myrmornis wrote:
             | Basic paredit operations work surprisingly well on C-like
             | languages like Python. Try it! I think it does ok on Rust
             | too. I'm thinking mainly of paredit-kill and navigating
             | paired delimiters. A long time ago I collected together
             | some tweaks for using it with Python etc here:
             | 
             | https://github.com/dandavison/paredit-c
        
               | mickeyp wrote:
               | Ha. I, too, hacked paredit to work with Python about a
               | decade ago for the same reasons as you. And yes, it does
               | work better than you'd think.
        
               | Myrmornis wrote:
               | Hi Mickey, ah no -- you've done WAY more than me in this
               | area! I had been meaning to try your combobulate package.
               | 
               | FWIW: after 20 years of Emacs I personally switched to
               | VSCode a couple of years ago because I felt that in Emacs
               | I was missing out on the LSP experience that VSCode
               | provided in Rust, Typescript, Scala, etc. (I was using
               | Eglot). In any case, there's a very nice Emacs emulation
               | mode in VSCode
               | 
               | https://github.com/whitphx/vscode-emacs-mcx
               | 
               | which includes some paredit functionality courtesy of
               | 
               | https://robert.kra.hn/past-projects/paredit-js.html
               | 
               | and I'm working on porting my favorite paredit function,
               | paredit-kill. Unfortunately that's the one where the
               | paredit author left this comment in the code:
               | ;;; Please do not try to understand this code unless you
               | have a VERY       ;;; good reason to do so.  I gave up
               | trying to figure it out well       ;;; enough to explain
               | it, long ago.
        
               | tuukkah wrote:
               | > _C-like languages like Python_
               | 
               | I can see Paredit working somehow with the curly brace
               | blocks of C, but how does it handle the significant
               | whitespace of Python? Are indent and dedent handled as
               | tokens?
        
               | Myrmornis wrote:
               | No, I've never tried to make it do that. So in Python
               | paredit-kill will not kill a function definition, whereas
               | it would in a language that uses braces for function
               | bodies.
        
               | capableweb wrote:
               | Does it automatically balances all the
               | parenthesis/brackets/other characters? I think that's
               | what I'm missing the most.
        
               | Myrmornis wrote:
               | Yep.
        
       | georgeoliver wrote:
       | What do people think about paredit vs. just using the regular
       | sexp editing commands (https://www.gnu.org/software/emacs/manual/
       | html_node/emacs/Pa...)? Especially when you rebind those to
       | easier key combos.
       | 
       | Honestly I feel like those are enough for 90% of what I'm doing,
       | and for now learning Paredit/infer is low on the priority list.
       | Is it worth moving it up?
        
         | nerdponx wrote:
         | I use (Neo)Vim which only has minimal Lisp support built in. I
         | started using Parinfer and it made a huge positive impact on my
         | experience writing Lisp. It would probably be less impactful if
         | I already had a good workflow and keyboard shortcuts that I
         | liked.
         | 
         | But Parinfer is particularly nice in that it makes not just
         | editing easy, but also refactoring, which historically was one
         | of my big annoyances with s-expressions.
         | 
         | Maybe Paredit has features for that too, but I didn't use it
         | (the Vim port) long enough to learn its ins and outs.
        
           | Jach wrote:
           | I'm a vim user and generally dislike tools typing for me at
           | the same time that I'm typing. I've gotten some value from
           | https://github.com/tpope/vim-sexp-mappings-for-regular-
           | peopl... though when writing Lisp.
        
       | mcbuilder wrote:
       | I've never had so much fun slurping and barfing as I have with
       | paredit.
        
       | kehrin wrote:
       | I've tried to switch to Paredit (from Evil) but had trouble. Does
       | anyone have a solid resource for learning?
        
         | casion wrote:
         | Switch? They're not mutually exclusive.
        
         | aidenn0 wrote:
         | Instead of paredit, I use adjust-parens with Evil and bind <<
         | and >> to lisp-indent-adjust-parens and lisp-dedent-adjust-
         | parens.
        
         | nanna wrote:
         | It took me a few attempts. What eventually worked was just
         | getting used to one major feature of it, barfing and slurping,
         | and after that it all clicked.
        
       | Xeoncross wrote:
       | Here I am trying to figure out who Paredit is and what he did
       | that so bad he was was sentenced for over eight years at 17.
        
       | agumonkey wrote:
       | thanks to the credits I got to learn about interlisp s-edit
       | 
       | here's a demo https://www.youtube.com/watch?v=2qsmF8HHskg
        
       ___________________________________________________________________
       (page generated 2022-11-26 23:00 UTC)