I've recently started using dedicated windows because I have certain windows (a python interpreter, sometimes a PDF of a LaTeX document), that I do not want obstructed under any circumstances. This mostly works great, except sometimes, I run a command that wants to open a new window and instead of splitting the window, it opens a whole new frame!

For an MWE of this issue, if you have AucTeX, try creating a buffer with the .tex extension and paste in the following code:

  (defun toggle-window-dedicated ()
    "Control whether or not Emacs is allowed to display another
buffer in current window."
     (if (let (window (get-buffer-window (current-buffer)))
         (set-window-dedicated-p window (not (window-dedicated-p window))))
         "%s: Can't touch this!"
         "%s is up for grabs.")
  (global-set-key (kbd "C-c d") 'toggle-window-dedicated)

First, evaluate the great big Elisp expression that I randomly put in the middle of my TeX file. Next, split your frame into two windows using C-x 2 or C-x 3. Type C-c d to make your current window dedicated, then C-x o to switch to the other, non-dedicated window. Now move the cursor the the word fish in \eqref{fish} and type C-c & to find the label its referring to.

Emacs opens a new frame! I have confirmed that Emacs25 has this behavior with a blank .emacs.

If you tried the same behavior with a frame containing only one window, Emacs sensibly splits the window. I would like Emacs to always split windows in situations like this, and never open new frames unless I explicitly request it.

First, Is there a way to do that? Second, should I file a bug report?

  • (elisp)Dedicated Windows. – Drew Jun 26 '17 at 3:51
  • @Drew While I've looked at that page before, I hadn't noticed the section on frame behavior, so thanks for pointing that out. It doesn't actually appear to directly address this precise situation. In particular, I don't think any of them discuss the possibility of a new frame opening, unless I'm missing something? – Zorgoth Jun 26 '17 at 20:19

Your Answer

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

Browse other questions tagged or ask your own question.