[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of dedicated windows in gdb-mi.el

From: Oleh Krehel
Subject: Re: Use of dedicated windows in gdb-mi.el
Date: Mon, 09 Feb 2015 15:50:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> From what I understand, this work-around is an illustration of the
>> point, rather than a solution: when someone presses C-x b, they want
>> to change the buffer displayed in the current window.  They do not
>> want to have to switch to  another window/frame before that, and they
>> do not want to see the desired  buffer appear in a random window.

Hi Stefan,

> I introduced "softly dedicated" windows for that kind of situation:
> a "softly dedicated" window would not be chosen normally when Elisp code
> wants to display some buffer somewhere, but if the user does `C-x b'
> then the "soft dedication" gets overruled.
> I know Martin doesn't like this concept, but in any case, if we could
> try and arrange for gdb-mi to mark its windows as softly dedicated,
> I think it would solve your use case.

Thanks, it solves it. Please see if the attached patch is OK.


>From e0b7210e4c9ad5c8175abe74f6f626d850472d00 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <address@hidden>
Date: Mon, 9 Feb 2015 15:45:00 +0100
Subject: [PATCH] gdb-mi.el (gdb-window-dedicated-flag): New flag

* lisp/progmodes/gdb-mi.el (gdb-window-dedicated-flag): This flag is
  passed to `set-window-dedicated-p' each time it needs to be called
  with a non-nil flag.
(gdb-display-buffer): Update.
(gdb-set-window-buffer): Update.
 lisp/progmodes/gdb-mi.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 27846ed..48f0cd2 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -252,6 +252,14 @@ lower token-number are out-of-order."
   :group 'gud
   :version "24.4")
+(defcustom gdb-window-dedicated-flag t
+  "Non-nil flag used for calls to `set-window-dedicated-p'."
+  :type '(choice
+          (const :tag "Plain" t)
+          (const :tag "Soft" soft))
+  :group 'gud
+  :version "25.1")
 (cl-defstruct gdb-handler
   "Data required to handle the reply of a command sent to GDB."
   ;; Prefix of the command sent to GDB.  The GDB reply for this command
@@ -4282,7 +4290,7 @@ overlay arrow in source buffer."
 (defun gdb-display-buffer (buf)
   "Show buffer BUF, and make that window dedicated."
   (let ((window (display-buffer buf)))
-    (set-window-dedicated-p window t)
+    (set-window-dedicated-p window gdb-window-dedicated-flag)
   ;; (let ((answer (get-buffer-window buf 0)))
@@ -4447,7 +4455,7 @@ window is dedicated."
   (when ignore-dedicated
     (set-window-dedicated-p window nil))
   (set-window-buffer window (get-buffer name))
-  (set-window-dedicated-p window t))
+  (set-window-dedicated-p window gdb-window-dedicated-flag))
 (defun gdb-setup-windows ()
   "Layout the window pattern for option `gdb-many-windows'."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]