This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (13)
- # asami (9)
- # aws (1)
- # aws-lambda (1)
- # babashka (37)
- # beginners (70)
- # calva (19)
- # cider (23)
- # clara (10)
- # clj-kondo (15)
- # cljdoc (14)
- # clojure (3)
- # clojure-bay-area (1)
- # clojure-europe (40)
- # clojure-nl (3)
- # clojure-serbia (1)
- # clojure-uk (31)
- # clojuredesign-podcast (1)
- # clojurescript (9)
- # community-development (7)
- # data-oriented-programming (1)
- # datomic (44)
- # emacs (13)
- # figwheel-main (14)
- # fulcro (6)
- # jobs (6)
- # malli (15)
- # meander (7)
- # off-topic (74)
- # other-languages (1)
- # pathom (3)
- # portal (3)
- # re-frame (25)
- # reagent (6)
- # reitit (2)
- # reveal (1)
- # rewrite-clj (6)
- # ring (5)
- # shadow-cljs (11)
- # specter (7)
- # xtdb (7)
Is Cider supposed to font-lock local bindings any differently? I've noticed it scatters
cider-local text properties everywhere, but doesn't seem to do anything in particular with them.
I don't think we were ever doing font-locking for those, we were just marking them as locals.
Yeah, I was looking at that section of code and couldn't figure out /what/ it was doing, besides marking them
(setq-local font-lock-fontify-region-function (cider--wrap-fontify-locals font-lock-fontify-region-function))
Perhaps this was working at some point and we broke it. I don't remember already. I see the code hasn't been touched in 5 years.
I see, thanks - also noticed that the locals it's picking up are almost always wrong and bleeding in from neighboring forms
I was basically trying to hack together an eldoc extension to show something useful in a
recur form by picking up the nearest target's binding names, and saw that the locals code had quite a bit of relevant logic written already.
Ah, looks like it doesn't handle destructured bindings - I'll have to figure that out another time
Most likely it was the initial version of something that we didn't finish. Now with
parse-clj it should be easier to do something like what you have in mind. This is one of the dream goal - file-level static analysis that's not depending on running external tools.
That does seem a lot nicer and less brittle than the regex / point moving approaches that are currently implemented!
Though I'd be worried about performance, right now I basically have to choose between
clojure-indent-use-backtracking, otherwise editing on my laptop slows to an crawl on large forms... the indentation logic starts taking up 50% of the CPU and triggering GC pauses every few seconds
ok, I see there's
cider-file-loaded-hook, I think that's exactly what I need. If anyone knows of some example code that'd be much appreciated
In your case you'll be triggering some evaluation function of course, there are many of those.
this will run on each file loaded. Not sure why you're loading the buffer so much, but i'd probably put a
(comment (require 'this-ns :reload)) and inside of that comment form the instrument call as well. I think i remember a patch to add evaluation from a register and that comes to my mind
i'd save the instrument form in a register and then send it to the repl
;; ‘C-x r s <register-key>’ save to register ;; 'C-c C-j x <register-key' to send to repl (defun cider-insert-register-contents (register) (interactive (list (register-read-with-preview "From register"))) (let ((form (get-register register))) ;; could put form into a buffer and check if its parens are ;; balanced (if form (cider-insert-in-repl form (not cider-invert-insert-eval-p)) (user-error "No saved form in register")))) (define-key 'cider-insert-commands-map (kbd "x") #'cider-insert-register-contents) (define-key 'cider-insert-commands-map (kbd "C-x") #'cider-insert-register-contents) (define-key cider-repl-mode-map (kbd "C-c C-j") 'cider-insert-commands-map)