This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-08
Channels
- # announcements (11)
- # babashka (13)
- # beginners (11)
- # biff (2)
- # calva (17)
- # cider (19)
- # clojure (60)
- # clojure-berlin (1)
- # clojure-dev (20)
- # clojure-europe (48)
- # clojure-nl (1)
- # clojure-norway (98)
- # clojure-spec (7)
- # clojure-uk (5)
- # core-typed (32)
- # cursive (13)
- # datomic (12)
- # dev-tooling (5)
- # emacs (7)
- # figwheel-main (2)
- # graalvm (4)
- # hyperfiddle (4)
- # introduce-yourself (1)
- # malli (14)
- # missionary (32)
- # off-topic (7)
- # overtone (4)
- # pedestal (10)
- # proletarian (4)
- # re-frame (8)
- # releases (11)
- # tools-build (1)
- # tools-deps (4)
- # xtdb (38)
why does paredit refuse to let me fix broken parens?
[response-map ((handler) {:uri "/public/bliblablib"
:query-string nil
:request-method :get
:headers {}
:cookies {"ring-session"
{:value "testsession3"}})]
Paredit or cider correctly identifies the missing } because I see this in *Messages*
Mismatched bracket: found an opening { on line 65 and a closing )
But when I try to type one a } it just ignores my input and moves the cursor forward.(disclaimer; I use smartparens rather than paredit, but perhaps this might still work) Perhaps there's a better way, but what I usually do is quoted-insert
or C-q
, e.g. C-q }
. Afterwards I can remove any extra )
characters.
Generally, when you need to figure out what exactly happens when you do anything in Emacs, immediately after pressing a key, you'd run view-lossage
command (it's usually bound to C-h l
). That will show the last few keys you pressed alongside the commands they bind to.
Then you can simply debug the command.
In your specific case, however, that would be tricky. Because the command you'd see after pressing the key would be self-insert-command
. It's a built-in command (written in C), you can try debugging it by evaling (edebug-instrument-function #'self-insert-command)
, but that would make your Emacs instance pretty unusable, because it will trigger debugger frame for every single keypress.
Alright, when how do you figure out what is happening? You have to check the standard hooks, namely post-command-hook
and post-self-insert-hook
. Run describe-variable
, choose the hook, and you'd see which functions are running every time you try to insert or delete a char. Note that you have to do it in the same buffer - the value may differ depending on the modes activated in a buffer.
In your case you'd probably see something prefixed with sp-
, which is like Lasse noted, related to smartparens.el, perhaps smartparens-strict-mode
is on. Maybe that's why it won't let you add the brace.
Relatedly, you may want to use built-in check-parens
command, it usually navigates to the unbalanced part, making it easy to fix it.
As paredit is designed to prevent this kind of unbalanced parens, it's usually caused by an incorrect copy paste.
In which case, try copy paste the missing }
character, using one of the }
characters just pasted.
I also use the smartparens approach, C-q }
Or if using Evil editing mode, add a character or space where the }
should be and in normal mode use r
to substitute that temporary character with }
Or toggle paredit minor mode off and enter the character, then toggle paredit minor mode back on again
Wow @U0G75ARHC I didnt know about view-lossage! I'll try to get in thw habit of using that one.
@U05254DQM yes copy+paste mistake. i'll try that next time.