emacs

Joseph Graham 2025-08-08T05:53:43.104009Z

I have a syntax error due to copy+paste creating mismatched parens. paredit won't allow me to fix it! It blocks me from either adding an extra one or deleting the other. Is paredit supposed to prevent fixing mismatched parens?

practicalli-johnny 2025-08-08T06:05:56.600459Z

Its not meant to correct copy/paste errors. That's the job of the human that did the copy/paste incorrectly 🤣 Either undo the copy paste or switch off the structured editing tool and manually fix.

rolt 2025-08-08T06:11:37.891099Z

sometimes I switch to parinfer just to paste code and then back to paredit

teodorlu 2025-08-10T11:36:45.165529Z

As Dave, I do more copy and pasting, 1. Select a paren containing the thing I want 2. M-x expand-region 3. Kill (cut) 4. Undo the paste containing the mismatching parens 5. Yank (paste)

Joseph Graham 2025-08-08T07:09:29.096429Z

I feel like there should be some logic that if the parens are already mis-matched it doesn't block editing.

djm 2025-08-08T07:15:30.515709Z

I use smartparens instead of paredit these days, but IIRC it's C-q ) to add a closing one, and when deleting you need to use C-u. But I know some prefer just to turn paredit off and back on again instead.

👍 3
djm 2025-08-08T07:16:27.185689Z

(Apologies if I'm misremembering the specific keys)

Sophie Bosio 2025-08-08T07:29:44.456129Z

Yes, C-q allows literal character insert, so you're able to insert missing parens. C-<backspace> also lets you delete them 😊

😯 1
🎉 1
daveliepmann 2025-08-08T09:56:27.023329Z

Personally I fix copy-paste errors with copy-paste.

👍 1
🤯 1
🔥 1
➕ 1
practicalli-johnny 2025-08-08T12:29:42.043509Z

For obvious unballanced code, I may use Evil (vim-style) editing mode 6 visual select to fix copy/paste errors, v r <space> to visually select the paren and replace it with a blank space (my editor removes blank spaces on save) Or select a blank space and replace with a paren, e.g. v r )

practicalli-johnny 2025-08-08T12:32:18.003979Z

If its no obvious if the code being copied is balanced, then I would paste it into a new Clojure file (or at least a rich comment form at the end of a file) This avoids messing up any other code. Or just avoid copy / pasting code 🤣