15 ms·
Paredit 25 released, after 8 years
- pbiggar 4y agoParedit 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.
- rudy6912 4y agoAlso, Paredit now has a public website and repository.
- tsuru 4y agoCongrats! 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 4y agoSame 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?".
- Myrmornis 4y agoBasic 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 https://github.com/dandavison/paredit-c
- mickeyp 4y agoHa. 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 4y agoHi 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 https://github.com/whitphx/vscode-emacs-mcx which includes some paredit functionality courtesy of https://robert.kra.hn/past-projects/paredit-js.html 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.
- capableweb 4y agoDoes it automatically balances all the parenthesis/brackets/other characters? I think that's what I'm missing the most.
- Myrmornis 4y agoYep.
- tuukkah 4y ago> 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?
- 4y ago
- bhrgunatha 4y agoHere'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 https://tree-sitter.github.io/tree-sitter/#available-parsers
- agumonkey 4y agoback in the days, all there was was http://pub.gajendra.net/src/paredit-refcard.pdf http://pub.gajendra.net/src/paredit-refcard.pdf
- tym0 4y agoDo 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 4y agoI have a small section dedicated to Paredit in my Lisp in Vim post: https://susam.net/blog/lisp-in-vim.html 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-paredit 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.
- ngcc_hk 4y agoThanks very much for your post once again. I just setup every lisp refer to yours even though I can recall every step you mentioned by now. Still such a great post. But for paredit … whilst it is useful when it is useful it is in the way when it is not. I find the best way is to use ; so to disable it and then edit and then re-enable it by erasing ; There is option to disable but need a few jkeysfroke. Hence ; all the time. The most annoying feature may I say. Anyway just to say thanks thanks.
- susam 4y agoThank you for writing this comment. I am glad to know that you found the Lisp in Vim post useful.
- bongobingo1 4y agoAm I stupid or does this not say what it does anywhere on the site or repo. E: https://www.emacswiki.org/emacs/ParEdit https://www.emacswiki.org/emacs/ParEdit
- qorrect 4y agoIt'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 4y agoI 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 4y agoIf you click paredit.el, there’s prose explanation in the comments.
- gabiruh 4y agoYeah... a couple GIFs would. If I was them I would've just embedded this video from "Emacs Rocks!": https://www.youtube.com/watch?v=D6h5dFyyUX0 https://www.youtube.com/watch?v=D6h5dFyyUX0 It shows how incredible paredit is.
- losvedir 4y agoWow! That looks pretty amazing. Makes we wish I used both a lisp and emacs... Does anyone know if there is anything similar that works for non-lispy languages (using syntax like do/end, {}, etc?) and in VSCode?
- agumonkey 4y agothanks to the credits I got to learn about interlisp s-edit here's a demo https://www.youtube.com/watch?v=2qsmF8HHskg https://www.youtube.com/watch?v=2qsmF8HHskg
- reikonomusha 4y agoParedit 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.
- kehrin 4y agoI've tried to switch to Paredit (from Evil) but had trouble. Does anyone have a solid resource for learning?
- casion 4y agoSwitch? They're not mutually exclusive.
- nanna 4y agoIt 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.
- aidenn0 4y agoInstead of paredit, I use adjust-parens with Evil and bind << and >> to lisp-indent-adjust-parens and lisp-dedent-adjust-parens.
- bananamerica 4y agolispy+lispyville works well for a similar functionality. I use it on Doom Emacs, which configures everything for me.
- georgeoliver 4y agoWhat do people think about paredit vs. just using the regular sexp editing commands (https://www.gnu.org/software/emacs/manual/html_node/emacs/Parentheses.html 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 4y agoI 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 4y agoI'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-people/ https://github.com/tpope/vim-sexp-mappings-for-regular-peopl... though when writing Lisp.
- perihelions 4y agoIs 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".
- ahmedalsudani 4y agoParedit 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 4y agoYou probably know that, but there is smartparens mode which does similar magic to non-lisp languages: https://github.com/Fuco1/smartparens https://github.com/Fuco1/smartparens
- qorrect 4y agoI did not know that!
- ahmedalsudani 4y agoIn recent years, I have been spoiled by doom-emacs (and previously spacemacs). They have made everything work out of the box for me to such an extent that I mostly don't know what's active--I've just learned the right leader combination to get what I need done. It turns out I've been using smartparens without realizing--just opened a file and checked the active modes to find out. The keys I've learned are (using evil): - [Visual mode] S -> surround by a pair - [Visual mode] d <char> -> delete pair of <char> - [Visual mode] c <c1> <c2> -> replace pair of <c1> with pair of <c2> Those along with C-M-k to kill a sexp and % to go to the other end of a pair have been all I need for my work (the vast majority C/C++ and Python). One thing I keep putting off is figuring out a way to jump to the opening/closing quotes. For those I still have to go medieval if there's any nesting.
- billfruit 4y agoAnyone with experience of both paredit and smartparens, which would you recommend?
- philjackson 4y agoI can't live without smartparens-strict-mode - how do people edit lisp without it?!
- mcbuilder 4y agoI've never had so much fun slurping and barfing as I have with paredit.
- Xeoncross 4y agoHere 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.
- Existenceblinks 4y agoTook me more than 5 seconds to get the joke. Maybe I'm sleepy right now.
- Existenceblinks 4y agoJesus, believe it or not, someone downvoted me. For what?
- technoooooost 4y agoGo cry to mama
- Existenceblinks 4y agolmao, go fuck yourself.
- rahimnathwani 4y agoI read it differently. I thought it was a gang of 25 people, like "Ocean's 11". (I'm not joking.)
- The_suffocated 4y agoI thought so too, until I read the link "(paredit.org)" appended to the title and knew that Paredit is most likely some code/text editor.
- iainctduncan 4y agoCan anyone tell me if it's as helpful for Scheme? Thx!
- bhrgunatha 4y agoYes. It's aimed at languages that use parentheses for structure - so it's _definitely_ helpful for Scheme. We're generally so used to line-based editing, it may be frustrating but it's well worth the effort and once it clicks, you start to miss the features with other languages. There's some truth in the old joke "If you think paredit is not for you then you need to become the kind of person that paredit is for."
- MaysonL 4y agoTypo: it's actually version 26.
- _emacsomancer_ 4y agoNo, the release after 8 years was 25, but they've subsequently (in rapid succession) released more versions since.
- Existenceblinks 4y agoI hope structure editors strike back .. I mean I wish it's going mass.
- phforms 4y agoIf you want to go nuts with structural editing you may also want to check out symex mode: https://github.com/drym-org/symex.el https://github.com/drym-org/symex.el It uses paredit (among others) for its low level functionality, but the vim-style modal interface allows you to manipulate the tree structure with single keystrokes in a precise and very expressive way. Keep in mind that you have to actively learn how to use it and it will feel awkward at first (similar to how vim feels for beginners), but I find the editing experience very pleasent and smooth after I got used to it. Another thing I really like about it is that you can still switch to normal mode and it doesn’t get in your way like other plugins where I had to change my keybindings all the time because the amount of convenient shortcuts is still quite limited in the end. This modal switching to different editing contexts (or languages?) is something I feel should be explored much further.