This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-30
Channels
- # announcements (1)
- # asami (21)
- # babashka (10)
- # beginners (123)
- # cider (55)
- # cljfx (9)
- # clojure (21)
- # clojure-europe (25)
- # clojure-nl (4)
- # clojure-uk (6)
- # clojured (1)
- # clojurescript (29)
- # cursive (9)
- # datomic (8)
- # emacs (13)
- # events (1)
- # fulcro (21)
- # graalvm (10)
- # graalvm-mobile (13)
- # jobs (1)
- # luminus (4)
- # malli (7)
- # nrepl (9)
- # off-topic (24)
- # pathom (2)
- # podcasts-discuss (1)
- # reagent (5)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (33)
- # tools-deps (60)
- # vim (8)
- # xtdb (1)
is there a navigation function like end-of-defun
, that works on the ignored expressions (`#_) hidden expressions in cider. I was using
end-of-defun` but maybe there's been a change and it doesn't navigate properly to the end of the ignore expression
Could you be a little more specific about the behavior you're expecting? Like maybe a form
(let [a 1 b 2] |#_(ignored form) (+ a b))
combined with where you expect the cursor to end up post navigation?yes, so in my case I am working on a fn that will evaluation n forms from the current cursor, so say I have my cursor
(defn test-fn |[a] ...)
#_[(test-fn 1)
(test-fn [])]
I want to first go to the end of the current form and evaluate last sexp, end-of-defun
moves the cursor in the right place, after the current form, and I can evaluate fine. When I try end-of-defun
again, the cursor ends up here:
#_|[(test-fn 1)
(test-fn [])]
I expected another end-of-defun to go to the end of that sexp after it, but it skips it and goes to the end of whatever form is after thatI can work with just having it not uncommented, and comment it later since I expect to move it to a test area
(defun +user/eval-n-defuns (n)
(interactive "P")
(save-excursion
(dotimes (number (or n 2))
(end-of-defun)
(+user/run-eval-fun))))
the +user/run-eval-fun
just executes which eval to use in which major-modeIt's slightly above my pay grade to decide whether this is a bug in clojure-mode
although I would actually expect it is given that this appears to treat ;
comments differently than #_
comments as evidenced here
(defn test-fn <|>[a] (+ a 1))
#_[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))
end-of-defun
(defn test-fn [a] (+ a 1))
#_<|>[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))
Positioning me improperly just after the #_
reader macro.
end-of-defun
(defn test-fn [a] (+ a 1))
#_[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))<|>
Properly skipping the textual ;;;
comment and placing me at the end of the next form.
That may be worth reporting as a bug to clojure-mode
. I suspect it has something to do with the #_
not being marked with proper comment
text properties but again it's a little above my pay grade. :)
If I understand your requirements correctly, a workaround option would be to check for #_
before point as you're executing end-of-defun
and, if it's there, run end-of-defun until it's not there. That would skip any number of #_
commented forms.Acrually, ideally I want it not to skip, as you can properly cider-eval-last-sexp of an ignored form with cider. The purpose is to have the function you're testing above a commented form of usages of that function for quick feedback when you are developing. Then eventually move those usages to test cases. It's based on a technique I saw a blog about and used ever since. At the time it did work with those ignored forms
You also may be interested in this discussion. :) https://clojurians.slack.com/archives/C099W16KZ/p1625077166109100?thread_ts=1624974213.101000&cid=C099W16KZ
The good thing about my way is it displays the result inline, so if I want to set up a quick case I can see the result rather than "test pass" or "test fail". This helps craft output in a quicker way this was the gist I took it from https://gist.github.com/cstby/0cff1f7eb48eb18c6690e6cdb919ca69
I was also mistaken, before bounds-of-thing-at-point
worked
either way, I think I can figure out something for those
It's slightly above my pay grade to decide whether this is a bug in clojure-mode
although I would actually expect it is given that this appears to treat ;
comments differently than #_
comments as evidenced here
(defn test-fn <|>[a] (+ a 1))
#_[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))
end-of-defun
(defn test-fn [a] (+ a 1))
#_<|>[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))
Positioning me improperly just after the #_
reader macro.
end-of-defun
(defn test-fn [a] (+ a 1))
#_[(thing thing) (thing)]
;;; hello world
(defn test-fn [a] (+ a 1))<|>
Properly skipping the textual ;;;
comment and placing me at the end of the next form.
That may be worth reporting as a bug to clojure-mode
. I suspect it has something to do with the #_
not being marked with proper comment
text properties but again it's a little above my pay grade. :)
If I understand your requirements correctly, a workaround option would be to check for #_
before point as you're executing end-of-defun
and, if it's there, run end-of-defun until it's not there. That would skip any number of #_
commented forms.