Skip to content

Conversation

@alesya-h
Copy link

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.

@gfredericks
Copy link
Owner

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.

@SevereOverfl0w
Copy link
Contributor

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!).

@gfredericks
Copy link
Owner

now I'm curious what the .http-intercept namespace is, since it's not part of debug-repl :)

@SevereOverfl0w
Copy link
Contributor

SevereOverfl0w commented Mar 28, 2018 via email

@gfredericks
Copy link
Owner

I don't! It sounds interesting 😄

@SevereOverfl0w
Copy link
Contributor

SevereOverfl0w commented Mar 30, 2018

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)

@gfredericks
Copy link
Owner

wow; that's an amazing amount of code for me to have no memory of writing

@vemv
Copy link

vemv commented May 14, 2019

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!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants