From d65dc05ac050df54e7ad35f49c793310814bfbe7 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Wed, 15 Jan 2020 23:06:23 -0500 Subject: [PATCH] Fix: gdb opens new window to display source file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By design it shouldn’t, the problem is gud-display-line uses display-buffer instead of gdb-display-source-buffer. * lisp/gud.el (gud-display-line): add gdb-display-source-buffer, remove (setq gdb-source-window) at the bottom because it is taken care of in gdb-display-source-buffer --- lisp/progmodes/gud.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index d5fd1dce6f..86880b0b40 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -2829,7 +2829,9 @@ gud-display-line (gud-find-file true-file))) (window (and buffer (or (get-buffer-window buffer) - (display-buffer buffer '(nil (inhibit-same-window . t)))))) + (gdb-display-source-buffer buffer) + (setq gdb-source-window + (display-buffer buffer '(nil (inhibit-same-window . t))))))) (pos)) (when buffer (with-current-buffer buffer @@ -2859,9 +2861,7 @@ gud-display-line (widen) (goto-char pos)))) (when window - (set-window-point window gud-overlay-arrow-position) - (if (eq gud-minor-mode 'gdbmi) - (setq gdb-source-window window)))))) + (set-window-point window gud-overlay-arrow-position))))) ;; The gud-call function must do the right thing whether its invoking ;; keystroke is from the GUD buffer itself (via major-mode binding) -- 2.24.1