This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-26
Channels
- # announcements (1)
- # asami (7)
- # aws (3)
- # babashka (30)
- # beginners (21)
- # calva (48)
- # cider (11)
- # clj-commons (5)
- # clj-kondo (12)
- # cljdoc (5)
- # cljfx (1)
- # cljs-dev (32)
- # cljsrn (4)
- # clojure (218)
- # clojure-europe (88)
- # clojure-nl (11)
- # clojure-uk (31)
- # clojurescript (8)
- # cursive (98)
- # data-science (6)
- # datomic (49)
- # emacs (12)
- # events (4)
- # fulcro (47)
- # graalvm (3)
- # graphql (4)
- # introduce-yourself (5)
- # java (13)
- # juxt (9)
- # lsp (74)
- # meander (3)
- # membrane (4)
- # missionary (31)
- # off-topic (24)
- # pathom (41)
- # portal (4)
- # reagent (3)
- # releases (1)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # slack-help (2)
- # testing (20)
- # tools-deps (43)
ok, I really get paredit and never deleting parenthesis, but sometimes when the buffer gets scrambled (because I use evil and sometimes some commands do the wrong thing), I would just like to be able to edit normally to get back to a proper state. What is your workflow for doing that?
I just undo when that happens
In smartparens-mode (and probably in paredit-mode as well) any symbol prefixed with C-q
will be inserted as is, even it it produce unbalanced expression.
Disable it temporarily, make the change, then re-enable it? Paredit is a minor mode, right? It should have an interactive command called paredit-mode
to toggle it on or off.
yeah M-x paredit-mode
or this defun which I bind to shift+backspace:
(defun vemv/force-backspace ()
"Performs a deletion, overriding paredit safeguards"
(interactive)
(if (region-active-p)
(progn (call-interactively 'kill-region))
(delete-region (dec (point)) (point))))
Fellow borrowers of the above defun will want:
(defmacro dec (n)
`(- ,n 1))
I like the idea of binding S-<backspace>
better than toggling smartparens-strict-mode
which is what I was doing till now - thanks for the tip @U45T93RA6paredit don't know about cut with C-w
, and paste with C-y
, which might come handy.
So when these things happens i usually mark the superflous parenthesis and cuts it with C-w. If a parenthesis is missing - i copy one of the kind that is missing and paste one where it is missing.
There are Emacs packages to configure Evil to respect Clojure structure, such as https://github.com/luxbock/evil-cleverparens
This helps minimise the issue occurring when using vim-style editing.
Otherwise I would toggle the mode (I use smartparens in Spacemacs and toggle is SPC t p
)
I like the idea of using C-q
as a shortcut, as its usually just one paren. Also useful for copy paste fixes which easily have the same potential issue.