Fork me on GitHub

Hey fellow clojurians, not sure if this is the right place to ask, but I'm having a repl issue and since I use emacs + cider thought this might be the right place


The question is arguably better suited for #beginners channel as its not Cider specific.


sure, thanks for replying anyways thumbsup_all just wasn't sure if it was an issue with the classpath that maybe wasn't available from a cider repl.


The root cause is not always obvious 😁


from within the repl I'm not able to read files from the resoures folder with


I'm using deps.edn and have added resources to the paths vector


interestingly io/file works


@dev-hartmann file and resource functions read from different starting paths in the project. I believe file is from the root of the project and resource is from resources/ so you will need to adjust the file path accordingly. The following has an example, with the data files saved to the file space in /resources/data-sets/ so the path for resource starts at data-sets/


thanks for the pointer! I'm actually doing it exactly like that


(defn load-config [resource profile]
  (-> resource
      (get profile)))


read-config coming from juxt/aero


io/resource always returning null


so I guess I have something misconfigured


I'll post this to #beginners though, to not clutter up this thread


Just to expand further. io/resource is relative to any folders setup as class paths. Eg src, resources, test, clojure.jar, etc


Ah, I did think that might be the case, thanks for confirming.

Ian Fernandez11:05:24

heey guys, how I can configure cider to use .nrepl.edn to shadow-cljs nrepl middleware?


I haven’t seen any instructions how to use it standalone (without shadow kicking off the nREPL server), so you might have to ask at their issue tracker.


the question is how do you add custom middleware to the nrepl server cider starts?


NOT the one shadow-cljs starts.


Yeah, I think that’s the question. Normally you’d do this either via your project config (e.g. project.clj or nrepl.edn).

Ian Fernandez14:05:02

but how I can jack-in shadow.api/repl from mine cider repl, without jacking in first with shadow-cljs but with clj?


has anyone ever tried to get the *cider-test-report* buffer to open in a new emacs frame instead of the current behavior (for me, splitting the current emacs buffer in two)? I imagine you would have to do some overwriting of the functionality here:


this is a pretty unfortunate bug: the only workaround is to switch to native mode (which then takes a long while to index and doesn't ignore .gitignore files, requiring repeating them in .projectile).


@johanatan I think I’ve commented on this many times, as the ticket has been duplicated through the years - it’s not really a bug, it’s a limitation. If we apply postprocessing to the files returned by an external command (alien mode) we’re killing most of the benefits of using it, as this filtering is very expensive in Emacs Lisp.


The native indexing is already slow, so the filtering isn’t that big a deal with it.


Btw, did you try hybrid mode as well? I think it was somewhere in the middle. I haven’t had much time for Projectile lately, so I’m starting to forget what i’ve done there.


And what about native mode failing to respect gitignore?


Yep I tried hybrid and also see the failure to respect gitignore


Well, I can’t see how this can happen - after all it’s simply shelling out to git. 🙂


What exactly is “alien mode” btw? What’s it shelling out to?


Alien mode is shelling out the vcs or to find if the project is not VCS controlled.


You can see in the defcustoms what exactly is invoking for each supported VCS.


So native mode also “shells out to git”?


Hybrid is doing the same + some some file post-processing.


No, native mode just indexes the project in Emacs Lisp. That’s why it’s native (to Emacs).


Ok but that’s where I see it fail to respect gitignore. So what did you mean by “I can’t see how that could happen since it just shells out to git”


I actually reject the premise that post processing on alien would be untenable. Alien presumably returns a short, relevant list and then to apply some additional pruning based on .projectile should be very fast.


But I guess that’s what “hybrid” is supposed to be. However hybrid isn’t respecting gitignore for me


> Ok but that’s where I see it fail to respect gitignore. So what did you mean by “I can’t see how that could happen since it just shells out to git” That’s how the list of files is obtained


> I actually reject the premise that post processing on alien would be untenable. Alien presumably returns a short, relevant list and then to apply some additional pruning based on .projectile should be very fast. In a small project - sure, in a huge project you might have to check thousands of files against the ignored patterns. In Emacs Lisp that’s anything but fast. 🙂


i think if you're in the situation where the alien search didn't trim down the result set to something manageable, you're not in a situation to pick the final result yet and are most likely going to hit another key immediately thereafter, killing the first search and kicking off a new one. this process is going to repeat until you actually enter enough characters to begin to actually trim down the list to something manageable at which point a final post-process pass would not be burdensome at all.


all that you need for this to "feel" fast is the ability to kick off each search asynchronously and to kill earlier searches if keypresses are entered before they complete


it's an "interplay" between user and machine


a symbiosis / synergetic emergent phenomenon


and it would be awesome


and, sorry, i misspoke earlier, native does not exhibit any bugs (it's just really slow). hybrid and alien both have the same problem of .projectile ignores being ignored.


i.e., there appears to be no discernible difference between hybrid and alien


also, btw, SPC / (which uses ag) to search inside every single file is faster than projectile's filename only searching. how is this even possible? with my 100s of MBs of node_modules, we can search inside them faster than searching merely for their names?


unfortunately for me, there is a much higher chance of collision between filenames in node_modules/ that I don't care about and filenames in my codebase than there is for content in node_modules and content in my codebase.


and thus SPC / is imminently more usable than my current situation than SPC p f


and btw yet another bug is making this entire ordeal more painful that one would hope: