How can I force Emacs to keep a certain file in a particular window? For example, if I am editing a LaTeX file and there is a compile error, I want to inspect the error in another window. I essentially want to "freeze" a file in a window until I explicitly delete the window.
The expected behavior would also open up new files with C-x C-f
in a different window, even if the command was initiated in my "frozen" window. Is there a way to do this?
What I want to do is something like this:
- With two windows open, use one to edit a file.
- With some command, freeze that window so that it always displays the file that I have just opened.
- In the "frozen" window, execute a command such as
find-file
(C-x C-f
) to open a new file. This should open the file in the other window.
(set-window-dedicated-p (get-buffer-window) t)