From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.devel Subject: Re: Use of dedicated windows in gdb-mi.el Date: Mon, 09 Feb 2015 15:50:05 +0100 Message-ID: <87iofbb0ma.fsf@gmail.com> References: <87h9uynckc.fsf@gmail.com> <83iofedfkz.fsf@gnu.org> <877fvun97j.fsf@gmail.com> <83fvaid8sa.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1423493662 24133 80.91.229.3 (9 Feb 2015 14:54:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2015 14:54:22 +0000 (UTC) Cc: Thibaut Verron , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 09 15:54:18 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YKpj7-0002pL-R8 for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 15:54:17 +0100 Original-Received: from localhost ([::1]:33301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKpj7-00082e-Cf for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 09:54:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKpj2-0007vF-2k for emacs-devel@gnu.org; Mon, 09 Feb 2015 09:54:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKpiy-0005NR-3F for emacs-devel@gnu.org; Mon, 09 Feb 2015 09:54:12 -0500 Original-Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:49399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKpix-0005N9-S2 for emacs-devel@gnu.org; Mon, 09 Feb 2015 09:54:08 -0500 Original-Received: by mail-we0-f177.google.com with SMTP id l61so27325739wev.8 for ; Mon, 09 Feb 2015 06:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=A2JZhfZa2GHHctmWWGYYzbIEyHRe3onX6w6AHRcj8Fw=; b=ZlHzOgB1J4skLACByWQPPZeCyEq54gwoe/Ldt/1TGkN7mmguLHIHcqKLUyhGq4q1vY GU3u9Yoxmu7CWWnl5ZSSYseNzaIpVcIhJAtOcLkwJdFZsXfub1LecQQi1BBnK+bTJ4ay 2uO1mslh3NTESEIMwS4+7r8iWmpJ0hw3UWsAaNX6Yfca8nuHFn+R9ZOig/H4JWu5GLm6 A8GwumhIOkqk/+xeP7hxVkScfji2h4vgy2tYAebAYy/DFBhzLdxpRNdCa+y+9m2jux+i lS1HyoCFRnEleSzuFxKZe+JY+Se4hsZ9iPYk+CKSrDA6quTCxdsIH+MIQ2YJ0xxAqCyM 9pUA== X-Received: by 10.194.200.233 with SMTP id jv9mr43404345wjc.51.1423493638252; Mon, 09 Feb 2015 06:53:58 -0800 (PST) Original-Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id n1sm14736406wib.11.2015.02.09.06.53.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 09 Feb 2015 06:53:57 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Mon, 09 Feb 2015 09:29:34 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182693 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier 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. Oleh --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-gdb-mi.el-gdb-window-dedicated-flag-New-flag.patch >From e0b7210e4c9ad5c8175abe74f6f626d850472d00 Mon Sep 17 00:00:00 2001 From: Oleh Krehel 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) window)) ;; (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'." -- 1.8.4 --=-=-=--