This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-20
Channels
- # beginners (49)
- # boot (139)
- # cider (10)
- # clojure (82)
- # clojure-belgium (59)
- # clojure-dusseldorf (5)
- # clojure-russia (11)
- # clojure-sanfrancisco (2)
- # clojure-uk (56)
- # clojurebridge (4)
- # clojurescript (138)
- # cursive (19)
- # datomic (8)
- # dirac (1)
- # editors (11)
- # emacs (18)
- # flambo (21)
- # hoplon (45)
- # jobs (1)
- # juxt (3)
- # keechma (1)
- # mount (43)
- # off-topic (2)
- # om (64)
- # om-next (1)
- # onyx (2)
- # other-languages (8)
- # re-frame (72)
- # reagent (99)
- # ring-swagger (7)
- # rum (3)
- # spacemacs (21)
- # specter (5)
- # untangled (42)
- # vim (4)
- # yada (7)
hey… anyone has written a piece of snippet that would allow to use #_
reader macro? I’d like to comment/uncomment keybinding to work with that. it should be pretty straightforward to write, wondering if anyone already done this and I could just steal it?
@ag is this what you're looking for?
(defun comment-reader-macro ()
(interactive)
(unless (eq ?\( (following-char))
(paredit-backward-up))
(insert "#_"))
I won't run this in production, but:
(defun am-i-in-a-commented-sexp ()
(condition-case nil
(save-excursion
(unless (and (eq ?\( (following-char))
(eq ?_ (preceding-char)))
(paredit-backward-up))
(or (eq ?_ (preceding-char))
(am-i-in-a-commented-sexp)))
(error nil)))
(defun comment-uncomment-reader-macro ()
(interactive)
(if (am-i-in-a-commented-sexp)
(progn
(search-backward "#_")
(delete-char 2))
(progn
(unless (eq ?\( (following-char))
(paredit-backward-up))
(insert "#_")))))
Uncommenting should work anywhere within the commented sexp.