0

I'm now using this config:

(use-package slime
  ...
  ...
  :hook
  (slime-mode . (lambda ()
          (unless (slime-connected-p)
            (let ((bak-buffer (current-buffer)))
              ;; (delete-other-windows)
              ;; (split-window-horizontally)
              (save-excursion (slime))
              ))
          )))

And that is what I get when open a .lisp first time(previous window is only a scratch window) enter image description here

But what I want is something like this: enter image description here

Notice that I want slime to be on the left, and .lisp to be right, due to some environmental factor.

5
  • what's the result when you try (delete-other-windows) (split-window-horizontally)? – PanJunjie潘俊杰 Oct 16 '20 at 6:43
  • Just like without it. – C-Entropy Oct 16 '20 at 6:58
  • add a (print (window-list)) to see whether those code run after slime split windows into 3. it's possible you're not timing it right. – PanJunjie潘俊杰 Oct 16 '20 at 7:04
  • I use this : (unless (slime-connected-p) (let ((bak-buffer (current-buffer))) (print (window-list)) (delete-other-windows) (print (window-list)) (split-window-horizontally) (print (window-list)) (save-excursion (slime)) (print (window-list)) )) – C-Entropy Oct 16 '20 at 8:20
  • and that is the output: (#<window 5 on *scratch*>) (#<window 5 on *scratch*>) (#<window 5 on *scratch*> #<window 10 on *scratch*>) Polling "/tmp/slime.13236" .. 1 (Abort with ‘M-x slime-abort-connection’.) (#<window 10 on *inferior-lisp*> #<window 5 on *scratch*>) Polling "/tmp/slime.13236" .. 2 (Abort with ‘M-x slime-abort-connection’.) Connecting to Swank on port 45167.. Connected. Let the hacking commence! – C-Entropy Oct 16 '20 at 8:23
0

This code seems to work

(slime-mode . (lambda ()
          (unless (slime-connected-p)
            (let ((bak-buffer (current-buffer)))
              (slime)
              (delete-other-windows)
              (split-window-horizontally)
              (other-window 1)
              (switch-to-buffer bak-buffer)
              ))
          ))

  • Looks like slime-mode is applied to the buffer when you open a lisp file, and it is evaluating (slime) that opens a REPL and layout the windows as 3.

  • (slime) and your code both do window layouting and obviously the one executed later would overwrite what's done earlier.

So you need to put extra window layouting after the statement (slime).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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