How to protect windows in Slime to prevent it replacing your buffers

When you compile something in Slime it can create a number of temporary buffers, which it opens all over the place. I assume that it opens these buffers in the current window (or frame, or whatever the Slime terminology is), but the odd thing is that the behaviour changes (I think it will cycle buffers). Either way it can replace the contents of an existing window, which is particularly annoying when it replaces your code with a buffer telling you what’s wrong with the code and you then have to piss abount trying to get your code buffer back.

This code in ~/.emacs will allow you to use the pause key to protect windows by locking them to their current buffer. This will prevent e.g. slime compiler messages replacing those windows’ contents.

(defun toggle-current-window-dedication ()
 (let* ((window    (selected-window))
        (dedicated (window-dedicated-p window)))
   (set-window-dedicated-p window (not dedicated))
   (message "Window %sdedicated to %s"
            (if dedicated "no longer " "")

(global-set-key [pause] 'toggle-current-window-dedication)

Lifted from Emacs: dedicated windows

Last modified: 25/06/2012 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top