Skip to content

Function to select repls as the current active connection #190

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 4 commits into from
Mar 20, 2021

Conversation

dpsutton
Copy link
Contributor

@dpsutton dpsutton commented Mar 20, 2021

Helpful little function to ease the use case of multiple connections. There's a global connection that all commands use: inf-clojure-buffer. Changing this allows using different connections. This function just sets that to current buffer if in a repl, shows a list of live process inf-clojure repls if not, and if given a prefix, always shows a list so you can switch even if you're currently in a repl. The repl type is in a defvar-local inf-clojure-repl-type so that doesn't need to be set or re-inferred.

Renaming buffers with projects and repl types makes this quite nice, and the dead simple way it works means that things can be evaluated from any buffer (project irrespective) and no edge cases like last focused buffer or anything like that.

image

@dpsutton dpsutton force-pushed the selecting-repls branch 2 times, most recently from ca9301e to 3aad040 Compare March 20, 2021 07:23
very simple: if in a repl, use that. if not in a repl, display a list
of inf-clojure process buffers. If given a prefix, always show a list.

Makes running simultaneous repls far easier
inf-clojure.el Outdated
repls and offer a choice. Recommended to rename buffers as they
are created with `rename-buffer`."
(interactive "P")
(cl-flet ((inf-clojure-repl-p () (and (derived-mode-p 'inf-clojure-mode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest having this and a inf-clojure-repls fucntion to be top-level functions. I can imagine they'd be useful in some other situations as well.

@bbatsov
Copy link
Member

bbatsov commented Mar 20, 2021

Nice little change indeed. Might also be a good idea to update the modeline for inf-clojure-minor-mode to display the active REPL (similar to what CIDER does). That's another simple change.

@arichiardi
Copy link
Contributor

Looks like I will have to try inf-clojure again 😃 Good idea here!

note this changes the `inf-clojure-buffer` to always be a _buffer_ and
not the name of a buffer. Seems like renaming can be quite risky since
it was just a name of the buffer rather than the buffer.
@dpsutton
Copy link
Contributor Author

image

image

@bbatsov bbatsov merged commit f7b6a8e into clojure-emacs:master Mar 20, 2021
@bbatsov
Copy link
Member

bbatsov commented Mar 20, 2021

Nice!

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants