Made debugging available globally, without a need to require in every namespace
It is really inconvenient having to require com.gfredericks.debug-repl in every namespace while you debugging, especially given usually one has debug-repl in their user profile, not in a project definition, so having that requires permanently in every namespace in most cases won't work.
This patch adds break!, unbreak!, unbreak!! and catch-break! to clojure.core before nrepl middleware is installed.
I chose immediate global installation rather then on-demand global installation because functions/macros will be available only to namespaces that are defined afterward unless those namespaces are manually reloaded (or unless you call (use 'clojure.core :reload) when in that namespace).
It doesn't modify any existing functions in clojure.core, only adds new ones, so it should be safe. Given debug-repl is a development tool I think it's ok to tinker with internals a little when it will lead to better development experience.
This looks useful, but I don't think a library should force this on the user.
I personally solve this problem by using lein-shorthand (not just for debug-repl, but for all sorts of other utilities I want globally accessible as well), but you could also put something similar to the code in this PR in your :injections section of your user profile.
If you think it would help, I wouldn't mind a section of the README that shows users how to do that.
For data, I solve this in a curious way in combination with vim.
I have a custom command LoadDebugger which does (require 'com.gfredericks.debug-repl.http-intercept 'com.gfredericks.debug-repl).
This then has the namespace loaded.
Then I have abbreviations like break! which expand to (com.gfredericks.debug-repl.http-intercept/break!).
now I'm curious what the .http-intercept namespace is, since it's not part of debug-repl :)
You may recall writing a ring thing a while back for someone, that was me.
I have been meaning to contribute it back sometime soon.
On March 28, 2018 10:46:16 PM GMT+01:00, Gary Fredericks [email protected] wrote:
now I'm curious what the
.http-interceptnamespace is, since it's not part ofdebug-repl:)-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/gfredericks/debug-repl/pull/6#issuecomment-377048092
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
I don't! It sounds interesting :smile:
https://github.com/gfredericks/debug-repl/tree/http-intercept here it is. I still actively use this. (anything I have on top is pushed up: https://github.com/SevereOverfl0w/debug-repl/tree/http-intercept)
wow; that's an amazing amount of code for me to have no memory of writing
Personally I solve this problem via ~/.lein/profiles.clj:
{:repl-options {:init (do (require 'com.gfredericks.debug-repl) ...
Requiring the namespace just once suffices to have the code loaded in any user namespace - whether it had a :require com.gfredericks.debug-repl or not.
Then I use snippets, just like @SevereOverfl0w:
I have abbreviations like break! which expand to (com.gfredericks.debug-repl.http-intercept/break!).