From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi layout Date: Fri, 13 Mar 2020 22:13:05 +0100 Message-ID: <87h7ysnela.fsf@gmail.com> References: <91E91E25-9956-4D10-BD99-DC028156731C@gmail.com> <87d09jp7he.fsf@gmail.com> <916b2fef-b1bb-1c0c-1b43-4609cd768a79@gmx.at> <878sk6ot4z.fsf@gmail.com> <0EF37881-F1DA-48AD-8F4E-05A37041BD98@gmail.com> <301E3A87-7ED6-4E0A-A6DA-ABF84EB85B2F@gmail.com> <87lfo4netg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="97868"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 39181@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 13 22:13:20 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCrcN-000PJ1-5n for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 22:13:19 +0100 Original-Received: from localhost ([::1]:36792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCrcM-0002Fe-5I for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 17:13:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCrcB-0002C7-7e for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:13:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCrc5-00056h-Uw for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:13:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCrc5-000564-PW for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:13:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCrc5-00075f-Jq for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2020 21:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39181 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39181-submit@debbugs.gnu.org id=B39181.158413397427241 (code B ref 39181); Fri, 13 Mar 2020 21:13:01 +0000 Original-Received: (at 39181) by debbugs.gnu.org; 13 Mar 2020 21:12:54 +0000 Original-Received: from localhost ([127.0.0.1]:60289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCrby-00075J-8K for submit@debbugs.gnu.org; Fri, 13 Mar 2020 17:12:54 -0400 Original-Received: from mail-wm1-f66.google.com ([209.85.128.66]:38512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCrbw-000756-9Q for 39181@debbugs.gnu.org; Fri, 13 Mar 2020 17:12:53 -0400 Original-Received: by mail-wm1-f66.google.com with SMTP id t13so5387882wmi.3 for <39181@debbugs.gnu.org>; Fri, 13 Mar 2020 14:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=tsyJsC8i1kSTKRT8BVgU7mILFCUy6Tpq1gK/PYhhQJA=; b=otGaIbt5wJ9V7RamiOdx3jUxm9ENEsjAeYMzC4/h5T+b7D818c4thvRXGd9TNI5I23 /POrDKJNRgVmHdXvDN+fmjyAWVQEOpq9LGqvnfk4vyx+yPLryPxMsixMr5OvQWL8bwsW ZKGc6l6vyHauzujRDdfCmPylJua476FBdjEyYpy8sBhloAD+213feWWjsNQDDNwhnW+v TlbEbKJqNxMwUfnP8mtGfru1RcTqwyDW52KwqAVcjRUQpwtlsf+IrGhQ+7orv50p5wl3 OzP7YoQeTKfRvUnNFQ8sAJ/MKpZw4d56406h96AOT0wpmtDOkDK494/CAjPuffJ/wG2Y MkcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=tsyJsC8i1kSTKRT8BVgU7mILFCUy6Tpq1gK/PYhhQJA=; b=kW6ap8C+2rm83zXxoF0oOjAm1eGM+nRanC2yA2Q7mf1nx4Dl8sWvwftwHjCGegJlu1 y26Ge/65gbHUr54iSb5O5rfdJP+qrZ///og2/BhRuStIA/YCX2k6KmV/zePdbKs9APeY 00bRPswI6buK2HMWCENSKSffq8uWk0YVC/b37nCN6bKxDkPE/8x3OERAWZSODBXiV3gd 2wJeH/XLxn1f/IJqDJJMnf4exkcj8C1oHpiLlC+s5SWvXNfYy4XhO+S/naemMwihoSwE 55xjjVrm1TXmb4fCnBQceboCxuiUrcyBMaGzR+Ep0T0CKWpCzLx8CjFhwNWL0pTvj2gf quzw== X-Gm-Message-State: ANhLgQ35JOuY+SDK6PyP1N7isYFELwURqEEtSGFgef1vw3G2IqPSYF4Z Iw2cixL6slsKkp/nY6Kpc60= X-Google-Smtp-Source: ADFU+vsU4hHr6d/GU4AKsnr+7hfSsBSyLh+FsIukgah8GLpnizY7ey5g52ShKqJSm12Q/XtrO4Ga0Q== X-Received: by 2002:a1c:5505:: with SMTP id j5mr2305236wmb.170.1584133966334; Fri, 13 Mar 2020 14:12:46 -0700 (PDT) Original-Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id i6sm17403183wru.40.2020.03.13.14.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 14:12:45 -0700 (PDT) In-Reply-To: <87lfo4netg.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177300 Archived-At: [resending to Cc: Martin and the bug list, sorry] On Fri, 13 Mar 2020 16:09:06 -0400 Yuan Fu wrote: > Apart from fixing all the mentioned issues, Almost... :-) > The window layout that we save to a file in gdb is a window > configuration structure with some small differences: simply loading > that window configuration with `window-state-put' doesn=E2=80=99t give ba= ck > your gdb layout. (because all the buffers (local, breakpoint, etc) are > different from session to session.) `gdb-load-window-configuration` > does some trick to recreate each buffers. Apart from that the layout > and window configuration is the same thing. Thank you for the clarification! It would be nice to have that in the documentation as well. > @@ -253,6 +255,25 @@ gdb-output-sink > disposition of output generated by commands that > gdb mode sends to gdb on its own behalf.") >=20 > +(defvar gdb--window-configuration-before nil > + "Stores the window configuration before starting gdb.") > + > +(defcustom gdb-restore-window-configuration-after-quit nil > + "Whether to restore the window configuration the user had before gdb s= tarts. Probably better stick to the standard "If non-nil, restore...". > @@ -4491,6 +4538,15 @@ gdb-preempt-existing-or-display-buffer > (define-key gud-menu-map [displays] > `(menu-item "GDB-Windows" ,menu > :visible (eq gud-minor-mode 'gdbmi))) > + (define-key menu [gdb-restore-windows] > + '(menu-item "Restore Default Layout" gdb-restore-windows > + :help "Restore standard layout for debug session. I.e., the layout= we get when session starts.")) How about just "Restore standard layout for debug session (the layout we get when session starts)." Or, even more concisely, "Restore the initial GDB window layout"? > + (define-key menu [load-layout] '("Load Layout" "Load GDB window config= uration (i.e. window layout) from a file" . gdb-load-window-configuration)) You can omit the "i.e.". Actually, even better perhaps just "window configuration (layout)"? Similarly below. > @@ -4606,41 +4659,174 @@ gdb-set-window-buffer > (set-window-buffer window (get-buffer name)) > (set-window-dedicated-p window t)) >=20 > +(defun gdb-toggle-restore-window-configuration () > + "Toggle whether to restore window configuration when GDB quit." ^^^^ quits > + (interactive) > + (setq gdb-restore-window-configuration-after-quit > + (not gdb-restore-window-configuration-after-quit))) > + > +(defun gdb-get-source-buffer () > + "Return a buffer displaying source file or nil if we can't find one. > + > +The source file is the file that contains the source location > +where GDB stops. There could be multiple source files during a > +debugging session, we get the most recently showed one. If > +program hasn't start running yet, the source file is the \"main ^^^^^ started > +file\" where the GDB session starts (see `gdb-main-file')." > + (if gud-last-last-frame > + (gud-find-file (car gud-last-last-frame)) > + (when gdb-main-file > + (gud-find-file gdb-main-file)))) > + > (defun gdb-setup-windows () > "Layout the window pattern for option `gdb-many-windows'." ^^^^^^ "Lay out" (verb) > @@ -4658,7 +4844,12 @@ gdb-many-windows >=20 > (defun gdb-restore-windows () > "Restore the basic arrangement of windows used by gdb. > -This arrangement depends on the value of option `gdb-many-windows'." > +This arrangement depends on the value of option > +`gdb-many-windows' and `gdb-default-window-configuration-file'." How about "This arrangement depends on the values of `gdb-many-windows' and `gdb-default-window-configuration-file'." > diff --git a/lisp/window.el b/lisp/window.el > index bd825c09e1..d774d906cd 100644 > --- a/lisp/window.el > +++ b/lisp/window.el > @@ -278,6 +278,24 @@ with-displayed-buffer-window > (funcall ,vquit-function ,window ,value) > ,value))))) >=20 > +(defmacro with-window-non-dedicated (window &rest body) > + "Evaluate BODY with WINDOW selected and temporarily made non-dedicated. ^^^^^^^^^^^^ This is now no longer true. Thank you, =C5=A0t=C4=9Bp=C3=A1n P.S.: This time your patch somehow ended up hidden as application/ocet-stream after the HTML part, instead of inline in plain text.