]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid messing up buffer list when starting gud (Bug#22374)
authorMichael Welsh Duggan <mwd@md5i.com>
Sun, 23 Nov 2014 23:34:28 +0000 (18:34 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Wed, 23 May 2018 11:53:58 +0000 (07:53 -0400)
* lisp/progmodes/gud.el (gud-common-init): Use `display-buffer'
instead of `switch-to-buffer'.

lisp/progmodes/gud.el

index de398350bd2b72ead5839c743c99372c593dace4..6826674a9427b7f50c4d2846c11e4c14cd9c4923 100644 (file)
@@ -2605,7 +2605,12 @@ comint mode, which see."
                      file-subst)))
         (filepart (and file-word (concat "-" (file-name-nondirectory file))))
         (existing-buffer (get-buffer (concat "*gud" filepart "*"))))
-    (switch-to-buffer (concat "*gud" filepart "*"))
+    (select-window
+     (display-buffer
+      (get-buffer-create (concat "*gud" filepart "*"))
+      '(display-buffer-reuse-window
+        display-buffer-in-previous-window
+        display-buffer-same-window display-buffer-pop-up-window)))
     (when (and existing-buffer (get-buffer-process existing-buffer))
       (error "This program is already being debugged"))
     ;; Set the dir, in case the buffer already existed with a different dir.