Emacs: Preventing gud & pdb from controlling windows

前端 未结 4 1417
栀梦
栀梦 2020-12-10 16:53

I\'m using pdb to debug Python programs and am unhappy with it\'s behaviour.

I have the screen divided into multiple emacs windows, and when I execute pdb, it (ran

4条回答
  •  天命终不由人
    2020-12-10 17:12

    You should use Sticky Windows to make your windows and buffers stick where they are but Sticky Windows won't stop gud/pdb from trying to steal your windows. When gud/pdb can't steal your source code window, it opens a new Emacs Frame even if there is another window on the current frame.

    This comes from the fact that the function that tries to jump to the gud-pdb buffer (py-pdbtrack-track-stack-file) calls function pop-to-buffer with argument OTHER-WINDOW set to t.

    To circumvent this behavior for all libraries that calls pop-to-buffer, you could cancel the role of OTHER-WINDOW by defining an advice on pop-to-buffer (in your .emacs) :

    (defadvice pop-to-buffer (before cancel-other-window first)
      (ad-set-arg 1 nil))
    
    (ad-activate 'pop-to-buffer)
    

    You should also customize variable pop-up-windows to nil in order to force display-buffer (the low-level routine used to display a particular buffer on windows and frames) to not create a new window.

提交回复
热议问题