This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-18
Channels
- # announcements (2)
- # aws (3)
- # beginners (35)
- # boot (10)
- # cider (33)
- # cljs-dev (22)
- # clojure (58)
- # clojure-belgium (1)
- # clojure-europe (8)
- # clojure-houston (1)
- # clojure-italy (47)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-uk (39)
- # clojurescript (12)
- # cursive (18)
- # data-science (1)
- # datomic (2)
- # emacs (24)
- # figwheel-main (29)
- # fulcro (24)
- # hoplon (14)
- # juxt (6)
- # kaocha (3)
- # nrepl (6)
- # off-topic (64)
- # om (1)
- # om-next (1)
- # pathom (21)
- # pedestal (18)
- # planck (40)
- # protorepl (1)
- # re-frame (15)
- # reagent (7)
- # reitit (16)
- # shadow-cljs (184)
- # spacemacs (4)
- # test-check (33)
I wonder what it would look like to have a function rescan the buffer every time you insert or remove a paren, and alert you if that action caused an imbalance.
It seems like the problem is often phrased as having a buffer with an imbalance and finding the paren that caused it, but the use case is “I took an action that imbalanced my parens, but didn’t know it.”
if you use paredit & co you simply can't have an imbalance
(depending on how you configure it I guess, but still they have your back most of the times)
kill-region will let you clobber parens. there are ways around paredit unfortunately
yeah, I had to learn that C-q )
will let you force in a closing paren when I have somehow done something that even confuses paredit.
Try M-x
check-parens
– you could always add this to a hook to run it automatically, e.g. after-save-hook
or after-change-functions
so can I ask paredit questions here? So in this function I left out a closing paren after cnt
in the second to last line:
(defn count-heads-pairs [coll]
(loop [cnt 0 coll coll]
(if (empty? coll)
cnt
(recur (if (= :h (first coll) (second coll))
(inc cnt)
cnt
(rest coll))))))
What is the paredit way of getting that in there?perfect! oh man, that was probably just basic stuff right there but I can see the power in really learning these tools. those old school names tho...
so forward-barf-sexp because it brought cnt
into the if
s-expression. so it was like the if
exp brought it into the fold?
ahh! See yeah, i'm missing the conceptual reasoning in the names. that makes more sense
http://danmidwood.com/content/2014/11/21/animated-paredit.html is a nice visual summary
i think i was confusing myself by thinking slurp-forward should be the same as barf-backward so why have both
So, I’m curious. People have been editing Lisp-like things since the 60s or something. What’s the brief history of lisp editing? There must have been an editing winter of say 40 years when no ideas were had?
can't help you there but I have just started watching the old SICP lecture videos and it was fun to see that even back then the editor (edwin?) would highlight that you closed a paren and Hal Abelson mentioned how awesomely useful that is for lisp editing. Maybe a fun topic for #off-topic
@mattias504 https://github.com/shaunlebron/history-of-lisp-parens there is a nice investigation here in the section on Editors
Hah. Of course there is. Thanks! Just recently listened to Shaun on one of the Clojure podcasts, very good and informative. 😀
And he had a fun talk a little why back. https://www.youtube.com/watch?v=K0Tsa3smr1w