I use emacs for latex, with pdf-tools. My layout is always a window with PDFView buffer on the right, any other buffer on the left.
I always want the right window that cannot be touched by anything, so I have a command anchor-buffer
;; custom function 'anchor-buffer'
(defun anchor-buffer ()
"Anchor the current buffer to the current window."
(interactive)
(set-window-dedicated-p (selected-window) t))
that doesn't allow to modify a window. Consider the following case
I have two windows (vertical split): Left window: tex source file, Right window: pdf file, pdf-view-mode (using pdf-tools)
I select the pdf buffer (on the right), and I do
M-x anchor-buffer
. According to the function above this should "glue" the buffer in the right window. At least myanchor-buffer
function works like this in all situations I tried.Now suppose I want to search for a reference using RefTex on the tex source (left window), and I do
C-c )
. A selection buffer opens in the right window which replaces the pdf viewer.
The latter should not happen because I invoked set-window-dedicated-p
on right window.
Any idea on how to solve this?
C-c C-)
is a RefTex command which is an example about how myanchor-function
breaks. that breaks. @Drew: sorry I edited my question, you are right, thanks.