instantiate repl buffer without popping to it

14 views
Skip to first unread message

pand...@gmail.com

unread,
Sep 17, 2013, 2:20:54 PM9/17/13
to nrep...@googlegroups.com
This has had me ripping my hair out all morning...

I'd like to fire up an nrepl session on emacs init, but I don't want the repl buffer to pop open a window.

For some reason, trying to work with cl-flet to temporarily redefine pop-to-buffer and then calling nrepl/nrepl-jack-in does not have any effect.

The only working solution I have found is using fset to just redefine pop-to-buffer to get-buffer-create, but that has obvious drawbacks for the rest of Emacs.

Anyone know how I can solve this? TIA
Murph

Phillip Lord

unread,
Sep 18, 2013, 6:40:31 AM9/18/13
to nrep...@googlegroups.com
Rather than define, why don't you advice the creation process. In
general, advice is nicer than redefining. It's also better to do
change something more specific -- pop-to-buffer is a very generic
function.

I think the guilty function is this one:

(defun nrepl-create-repl-buffer (process)
"Create a repl buffer for PROCESS."
(nrepl-init-repl-buffer
process
(let ((buffer-name (nrepl-repl-buffer-name)))
(pop-to-buffer buffer-name)
buffer-name)))


And this solves the problem -- or rather reverts the pop up!

(defadvice nrepl-create-repl-buffer
(after nrepl-create-advice activate)
(bury-buffer ad-return-value)
ad-return-value)


Phil

Steve Purcell

unread,
Sep 18, 2013, 7:37:34 AM9/18/13
to nrep...@googlegroups.com
Or, indeed:

(defadvice nrepl-create-repl-buffer
(around nrepl-create-advice activate)
(save-window-excursion
ad-do-it))

-Steve
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "nrepl-el" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nrepl-el+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages