clojure-emacs / inf-clojure

Basic interaction with a Clojure subprocess
251 stars 45 forks source link

Optionally create new buffer on inf-clojure #42

Closed arichiardi closed 7 years ago

arichiardi commented 7 years ago

I started to use this a bit more again 😀 The usual thanks @bbatsov and contributors for your work.

I would like to have inf-clojure create a buffer that is different from the one I am launching it from. Like cider basically.

I understand this of course might be optional and I am already checking switching-buffers. Any hint is super appreciated.

bbatsov commented 7 years ago

I would like to have inf-clojure create a buffer that is different from the one I am launching it from. Like cider basically.

More details, please. :-) I'm not quite sure what you're aiming for.

arichiardi commented 7 years ago

Basically in cider whin I start the repl a new buffer is opened (unless I have zombies). In inf-clojure the repl is started in the same buffer. In other words if I have one window with one frame to start with, with cider a jack-in will split in the window in two frames. In inf-clojure only one buffer is used. I don't know if there is a cider conf or something else actually (I use pop-win as well) I will need to double check.

bbatsov commented 7 years ago

Ah, got it. Yeah, we can totally make this configurable. It's actually configurable in CIDER as well - turned out not everyone was a fan of the new REPL window.

hlolli commented 7 years ago

this is what I do to get around this

(with-current-buffer (buffer-name)
      (inf-clojure inf-clojure-program)
      (split-window-sensibly) 
      (previous-window)
      (previous-buffer))

The only thing I find annoying about cider is that the cursor ends on the repl buffer after jack-in, I prefer to end up in the buffer Im working on with a repl window opened ready to accept my commands. I'm open for discussion what's the best default. At least not splitting the buffer seems at odd with what I would expect, (just my opinion).

arichiardi commented 7 years ago

Oh looks great ! Imho the cursors should either go at the end of the first top level form or stay put (configurable).

bbatsov commented 7 years ago

The only thing I find annoying about cider is that the cursor ends on the repl buffer after jack-in, I prefer to end up in the buffer Im working on with a repl window opened ready to accept my commands.

That's already configurable in cider. :-)

bbatsov commented 7 years ago

@hlolli Some different code would be needed to have this as part of the mode. The only difficulty is figuring out how to plug into the comint init sequence as the new buffer gets created before inf-clojure is run. We can always adjust the windows in the the inf-clojure-mode-hook, but I'd prefer to do it at init time if possible.

bbatsov commented 7 years ago

Forget what I said, I'm an idiot. :-) Obviously the only thing that needs to be changed is the inf-clojure function and the changes needed there are trivial.

bbatsov commented 7 years ago

Feel free to open a separate issue about the cursor's position on repl start/swich.