0

I usually have emacs open in 4 sections

code slime
code terminal

When I am setting up, and i open slime with M-x Slime, it opens up in one of the other buffers.

Question -- How do I control which buffer slime opens in?

2
  • emacs.stackexchange.com/tags/elisp/info
    – Drew
    Commented Jan 18, 2023 at 0:29
  • 1
    Only one question per post, please. Please keep one of your questions here and move the other to a separate post. Thx.
    – Drew
    Commented Jan 18, 2023 at 0:30

1 Answer 1

1

slime-start (in slime.el) calls pop-to-buffer. One idea would be to change that to switch-to-buffer, and another idea would be to customize the display-buffer-alist: https://www.gnu.org/software/emacs/manual/html_node/elisp/The-Zen-of-Buffer-Display.html

switch-to-buffer will target the current / selected window. See also set-window-buffer as a way to control which window is targeted. display-buffer with the appropriate targeting function and alist settings can also be used to target a specific window.

How did I ascertain which slime function calls pop-to-buffer?

STEP #1: Install slime and set the load-path correctly.

STEP #2: (require 'slime)

STEP #3: M-x find-function RET slime RET

STEP #4: Move the cursor to slime-start* and repeat the process: M-x find-function RET slime-start* RET. By placing the cursor on the desired function, the default for find-function will be the function at point.

STEP #5: Move the cursor to slime-start (note the lack of the asterisk *) and repeat the process once again: M-x find-function RET slime-start RET.

STEP #6: We see that the last line of slime-start is (pop-to-buffer (process-buffer proc)).

If the O.P. chooses to modify slime.el directly, then check to see whether there is a corresponding byte-compiled file with the name slime.elc. If so, then re-byte-compile the modified Lisp file with M-x byte-compile-file. Then, restart Emacs or evaluate the modified function so that the current instance becomes aware of the modification.

1
  • Extremely helpful. Thank you.
    – Vinn
    Commented Jan 18, 2023 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.