Commit 8c27235e authored by Chong Yidong's avatar Chong Yidong

Fix how gdb-mi calls display-buffer to avoid switching frames.

* lisp/progmodes/gdb-mi.el (gdb-display-buffer-other-frame-action):
Convert to defcustom.
(gdb-get-source-file): Don't bind pop-up-windows.

* lisp/progmodes/gud.el (gud-display-line): Don't specially re-use
other frames for the gdb-mi case.

Fixes: debbugs:12648
parent 1a9327d5
2012-10-18 Chong Yidong <cyd@gnu.org>
* progmodes/gdb-mi.el (gdb-display-buffer-other-frame-action):
Convert to defcustom.
(gdb-get-source-file): Don't bind pop-up-windows.
* progmodes/gud.el (gud-display-line): Don't specially re-use
other frames for the gdb-mi case (Bug#12648).
2012-10-18 Stefan Monnier <monnier@iro.umontreal.ca> 2012-10-18 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/advice.el: Clean up commentary a bit. * emacs-lisp/advice.el: Clean up commentary a bit.
......
...@@ -1516,9 +1516,9 @@ this trigger is subscribed to `gdb-buf-publisher' and called with ...@@ -1516,9 +1516,9 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
(comint-exec io-buffer "gdb-inferior" nil nil nil) (comint-exec io-buffer "gdb-inferior" nil nil nil)
(gdb-inferior-io--init-proc (get-buffer-process io-buffer)))))) (gdb-inferior-io--init-proc (get-buffer-process io-buffer))))))
(defvar gdb-display-buffer-other-frame-action (defcustom gdb-display-buffer-other-frame-action
`((display-buffer-reuse-window display-buffer-pop-up-frame) '((display-buffer-reuse-window display-buffer-pop-up-frame)
(reusable-frames . 0) (reusable-frames . visible)
(inhibit-same-window . t) (inhibit-same-window . t)
(pop-up-frame-parameters (height . 14) (pop-up-frame-parameters (height . 14)
(width . 80) (width . 80)
...@@ -1526,8 +1526,11 @@ this trigger is subscribed to `gdb-buf-publisher' and called with ...@@ -1526,8 +1526,11 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
(tool-bar-lines . nil) (tool-bar-lines . nil)
(menu-bar-lines . nil) (menu-bar-lines . nil)
(minibuffer . nil))) (minibuffer . nil)))
"A `display-buffer' action for displaying GDB utility frames.") "`display-buffer' action for displaying GDB utility frames."
(put 'gdb-display-buffer-other-frame-action 'risky-local-variable t) :group 'gdb
:type display-buffer--action-custom-type
:risky t
:version "24.3")
(defun gdb-frame-io-buffer () (defun gdb-frame-io-buffer ()
"Display IO of debugged program in another frame." "Display IO of debugged program in another frame."
...@@ -4175,9 +4178,9 @@ buffers, if required." ...@@ -4175,9 +4178,9 @@ buffers, if required."
(if gdb-many-windows (if gdb-many-windows
(gdb-setup-windows) (gdb-setup-windows)
(gdb-get-buffer-create 'gdb-breakpoints-buffer) (gdb-get-buffer-create 'gdb-breakpoints-buffer)
(if (and gdb-show-main gdb-main-file) (and gdb-show-main
(let ((pop-up-windows t)) gdb-main-file
(display-buffer (gud-find-file gdb-main-file))))) (display-buffer (gud-find-file gdb-main-file))))
(gdb-force-mode-line-update (gdb-force-mode-line-update
(propertize "ready" 'face font-lock-variable-name-face))) (propertize "ready" 'face font-lock-variable-name-face)))
......
...@@ -2700,42 +2700,39 @@ Obeying it means displaying in another window the specified file and line." ...@@ -2700,42 +2700,39 @@ Obeying it means displaying in another window the specified file and line."
(gud-find-file true-file))) (gud-find-file true-file)))
(window (and buffer (window (and buffer
(or (get-buffer-window buffer) (or (get-buffer-window buffer)
(if (eq gud-minor-mode 'gdbmi)
(display-buffer buffer nil 'visible))
(display-buffer buffer)))) (display-buffer buffer))))
(pos)) (pos))
(if buffer (when buffer
(progn (with-current-buffer buffer
(with-current-buffer buffer (unless (or (verify-visited-file-modtime buffer) gud-keep-buffer)
(unless (or (verify-visited-file-modtime buffer) gud-keep-buffer) (if (yes-or-no-p
(if (yes-or-no-p (format "File %s changed on disk. Reread from disk? "
(format "File %s changed on disk. Reread from disk? " (buffer-name)))
(buffer-name))) (revert-buffer t t)
(revert-buffer t t) (setq gud-keep-buffer t)))
(setq gud-keep-buffer t))) (save-restriction
(save-restriction (widen)
(widen) (goto-char (point-min))
(goto-char (point-min)) (forward-line (1- line))
(forward-line (1- line)) (setq pos (point))
(setq pos (point)) (or gud-overlay-arrow-position
(or gud-overlay-arrow-position (setq gud-overlay-arrow-position (make-marker)))
(setq gud-overlay-arrow-position (make-marker))) (set-marker gud-overlay-arrow-position (point) (current-buffer))
(set-marker gud-overlay-arrow-position (point) (current-buffer)) ;; If they turned on hl-line, move the hl-line highlight to
;; If they turned on hl-line, move the hl-line highlight to ;; the arrow's line.
;; the arrow's line. (when (featurep 'hl-line)
(when (featurep 'hl-line) (cond
(cond (global-hl-line-mode
(global-hl-line-mode (global-hl-line-highlight))
(global-hl-line-highlight)) ((and hl-line-mode hl-line-sticky-flag)
((and hl-line-mode hl-line-sticky-flag) (hl-line-highlight)))))
(hl-line-highlight))))) (cond ((or (< pos (point-min)) (> pos (point-max)))
(cond ((or (< pos (point-min)) (> pos (point-max))) (widen)
(widen) (goto-char pos))))
(goto-char pos)))) (when window
(when window (set-window-point window gud-overlay-arrow-position)
(set-window-point window gud-overlay-arrow-position) (if (eq gud-minor-mode 'gdbmi)
(if (eq gud-minor-mode 'gdbmi) (setq gdb-source-window window))))))
(setq gdb-source-window window)))))))
;; The gud-call function must do the right thing whether its invoking ;; The gud-call function must do the right thing whether its invoking
;; keystroke is from the GUD buffer itself (via major-mode binding) ;; keystroke is from the GUD buffer itself (via major-mode binding)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment