Skip to content
New issue

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

By clicking “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? Sign in to your account

[Fix #1297] C-c M-n should act on both repls #1397

Merged
merged 2 commits into from
Nov 4, 2015
Merged

Conversation

expez
Copy link
Member

@expez expez commented Nov 4, 2015

In a cljc or cljx buffer hitting C-c M-n to switch the repl ns will now act on both repls so they are in sync.

(cons
(cider-other-connection (cider-current-connection))
connections)
connections)))
Copy link
Member

Choose a reason for hiding this comment

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

Kinda minor nitpick, but I think it reads a little better if you remove the second binding and use this inside the let body.

(when (or (derived-mode-p 'clojurec-mode)
          (derived-mode-p 'clojurex-mode))
  (push (cider-other-connection (cider-current-connection))
        connections))

Copy link
Member

Choose a reason for hiding this comment

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

Oh, and it needs to account for the fact that (cider-other-connection (cider-current-connection)) might be nil.

Make `project-directory` optional in
`cider-find-connection-buffer-for-project-directory`.  The default value
is found using `(clojure-project-dir)` starting at
`(cider-current-dir)`.  This is the most common use-case and should be
made easy.
@expez
Copy link
Member Author

expez commented Nov 4, 2015

Rewritten to address all comments. Thanks guys :)

@Malabarba
Copy link
Member

👍

@@ -220,6 +226,15 @@ file extension."
;; TODO: Add logic to dispatch to a matching Clojure/ClojureScript REPL based on file type
(car cider-connections)))

(defun cider-other-connection (connection)
"Return the first connection of another type than CONNECTION or nil."
Copy link
Member

Choose a reason for hiding this comment

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

Here it should say the connection has the same project.

@bbatsov
Copy link
Member

bbatsov commented Nov 4, 2015

This also needs a changelog entry.

Sorry about the extra comments - I was interrupted while going though the code the previous time.

@@ -761,18 +761,26 @@ text property `cider-old-input'."
(defun cider-repl-set-ns (ns)
"Switch the namespace of the REPL buffer to NS.

If invoked in a REPL buffer the command will prompt you for the name of the
If called from a cljc or cljx buffer act on both the Clojure and
ClojureScript REPL if there are more than one REPL present.
Copy link
Member

Choose a reason for hiding this comment

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

if there is more than one (otherwise it should be REPLs I think)

In a cljc or cljx buffer hitting `C-c M-n` to switch the repl ns will
now act on both repls so they are in sync.
bbatsov added a commit that referenced this pull request Nov 4, 2015
@bbatsov bbatsov merged commit 56d20b2 into master Nov 4, 2015
@bbatsov bbatsov deleted the keep-dual-repls-in-sync branch November 4, 2015 17:31
@bbatsov
Copy link
Member

bbatsov commented Nov 4, 2015

👍

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.

3 participants