From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi layout Date: Fri, 13 Mar 2020 17:40:30 -0400 Message-ID: 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> <87h7ysnela.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_9629F9EB-298F-4520-A2A2-F7CA5EE269BA" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="110263"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39181@debbugs.gnu.org To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 13 22:41:14 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 1jCs3N-000SYT-Iu for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 22:41:13 +0100 Original-Received: from localhost ([::1]:38038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCs3M-0004uq-Gn for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 17:41:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39841) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCs3D-0004sf-TJ for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:41:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCs3C-0001Uf-Bl for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCs3C-0001T1-3V for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCs3C-0007lo-19 for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 17:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2020 21:41: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.158413564029834 (code B ref 39181); Fri, 13 Mar 2020 21:41:01 +0000 Original-Received: (at 39181) by debbugs.gnu.org; 13 Mar 2020 21:40:40 +0000 Original-Received: from localhost ([127.0.0.1]:60315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCs2p-0007l7-TO for submit@debbugs.gnu.org; Fri, 13 Mar 2020 17:40:40 -0400 Original-Received: from mail-qk1-f182.google.com ([209.85.222.182]:44838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCs2o-0007ku-0l for 39181@debbugs.gnu.org; Fri, 13 Mar 2020 17:40:38 -0400 Original-Received: by mail-qk1-f182.google.com with SMTP id f198so15209122qke.11 for <39181@debbugs.gnu.org>; Fri, 13 Mar 2020 14:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=h1hNJGv4psvqyVIqpPA9sBkmsqOW+AWY8lsJii1//Eg=; b=dDkMSnolH34BIzGyik8lQ4Z0bp2epGqNLLMkOlr0Xv2+ugHoICevwQp5MR7MXIjU59 BouyVFxU7faytcJjQdjvqVip6mIWQA5SVVXe6+CtV9gApMzXHb/avLIh6tZm2ul4XYCS GtMLk5pL2t9z98Vl7ozNBr1clGytJAK0fGsWewC+RmZz00CK3XgOh/UdgJiM38W8Ov2V H3vO3H9unN4LLgdiqm4F9YYHv+3DCEjBk/TREfhk1ri127pKLCiFU5R6Q3z7marwv4/g 1wGstDfLrRt1+l9Y+Cxh9giSV2IkSoQKlEYIXmbD6zgOawQRBo+7t5kmf5cBL176dssa POaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=h1hNJGv4psvqyVIqpPA9sBkmsqOW+AWY8lsJii1//Eg=; b=r6cb8KuozrS33IoxQ+kDRTD3jBuiAVPcLVNkqib8tgiaSdPpkX2h5TOx9mJ2X59Q8I 9SFj87LiT+u1ulG43ZA4FnntsTxaZyBKSKhUMPTZB3rmdOzBnM56M28cItxtalYjPb+z iwQWx9YsycI2xw+XsgGl2I4u69FsglJzm35yClFBuk7MgIaHtyvptZlpuSXnv9XR7lgh E10Q+BVy+CCgHRDr6676VcTneXF8/4jO8LPwszECNuGaz0I9xMQjcuJHNjHjUbB6kIkP 92Zh1JrJNjIi7GIGGtxr+pxo6kBPNLBGaSufTZpicMFjD7qonpS5QNcOAdAPciOTXlA2 t5Fg== X-Gm-Message-State: ANhLgQ2Msr8C3BiAEEaqKORUSINUBx1UAlF3AxoVCj0r5z7uwqwdJR9U Qwikli8hF+Fo67QXI6mZKXM= X-Google-Smtp-Source: ADFU+vvh48IGuSC60/Rla+yYjwniEx4gre+L0LDkJ1ql8thBVKSDI3MONNOpICEzkcrKEvpTVRbrAw== X-Received: by 2002:a05:620a:219a:: with SMTP id g26mr14748772qka.118.1584135632351; Fri, 13 Mar 2020 14:40:32 -0700 (PDT) Original-Received: from [192.168.1.5] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id 16sm10433511qkk.79.2020.03.13.14.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2020 14:40:31 -0700 (PDT) In-Reply-To: <87h7ysnela.fsf@gmail.com> X-Mailer: Apple Mail (2.3608.60.0.2.5) 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:177302 Archived-At: --Apple-Mail=_9629F9EB-298F-4520-A2A2-F7CA5EE269BA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 >> 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 back >> 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. >=20 > Thank you for the clarification! It would be nice to have that in the > documentation as well. I added some comments in the menu-map code. Hope that=E2=80=99s helps. >> @@ -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 starts. >=20 > Probably better stick to the standard "If non-nil, restore...". >=20 >> @@ -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.")) >=20 > 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"? >=20 >> + (define-key menu [load-layout] '("Load Layout" "Load GDB window = configuration (i.e. window layout) from a file" . = gdb-load-window-configuration)) >=20 > You can omit the "i.e.". Actually, even better perhaps just "window > configuration (layout)"? Similarly below. >=20 >> @@ -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 >=20 >> + (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 >=20 >> +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) All fixed. >=20 >> @@ -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'." >=20 > How about "This arrangement depends on the values of = `gdb-many-windows' > and `gdb-default-window-configuration-file'." >=20 I changed =E2=80=9Coption=E2=80=9D to =E2=80=9Cvariable=E2=80=9D, I have = to keep =E2=80=9Cvariable=E2=80=9D otherwise the byte compiler complains = about there existing function and variable =E2=80=9Cgdb-many-windows=E2=80= =9D. >> 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. >=20 Fixed. > Thank you, >=20 > =C5=A0t=C4=9Bp=C3=A1n Thanks for catching all the issues. >=20 > P.S.: This time your patch somehow ended up hidden as > application/ocet-stream after the HTML part, instead of inline in = plain > text. I=E2=80=99m not sure what causes that. I=E2=80=99ve been using Apple = Mail and I just copy the patch file into my reply. It actually surprises = me that they showed up in plain text before. This time I made the mail = plain text, hopefully that makes the patch also in plain text. Yuan --Apple-Mail=_9629F9EB-298F-4520-A2A2-F7CA5EE269BA Content-Disposition: attachment; filename=new-window.patch Content-Type: application/octet-stream; x-unix-mode=0700; name="new-window.patch" Content-Transfer-Encoding: quoted-printable =46rom=20baaae030b7ec76d91ba2798278ed06f92d4d8eec=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Tue,=20= 3=20Mar=202020=2018:30:03=20-0500=0ASubject:=20[PATCH]=20Add=20= store/restore=20window=20configuration=20feature=20for=20gdb-mi=0A=0AAdd=20= a=20feature=20that=20allows=20a=20user=20to=20save=20a=20gdb=20window=0A= configuration=20(window=20layout)=20to=20a=20file=20with=0A= 'gdb-save-window-configuration'=20and=20load=20it=20back=20with=0A= 'gdb-load-window-configuration'.=20=20Set=20a=20default=20window=20= configuration=0Aby=20setting=20'gdb-default-window-configuration-file'.=20= =20Note=20that=20for=20the=0Adefault=20window=20configuration=20to=20= take=20effect,=20'gdb-many-windows'=20needs=0Ato=20be=20t.=20=20Add=20an=20= option=20to=20make=20gdb=20preserve=20the=20window=20configuration=0A= that=20the=20user=20had=20before=20starting=20gdb.=20=20In=20window.el,=20= add=0A'with-selected-window-non-dedicated'.=0A*=20= lisp/progmodes/gdb-mi.el=20(require):=20add=20'pcase'=20and=20'cl-seq'.=0A= (gdb--window-configuration-before):=20New=20variable.=0A= (gdb-restore-window-configuration-after-quit):=20New=20custom=20= variable.=0A(gdb-window-configuration-directory,=0A= gdb-default-window-configuration-file):=20New=20variables.=0A(gdb):=20= Save=20configuration=20on=20startup.=0A(gud-menu-map):=20Add=20"Load=20= Layout"=20and=20"Save=20Layout"=20to=20menu.=20Add=0A"Restore=20Layout=20= After=20Quit"=20button=20to=20menu.=20=20Rename=20"Restore=20Window=0A= Layout"=20to=20"Restore=20Default=20Layout",=20add=20some=20help=20echo,=20= and=20move=20it=0Afrom=20"GDB-MI"=20menu=20to=20"GDB-WINDOWs"=20menu.=0A= (gdb-toggle-restore-window-configuration):=20New=20function.=0A= (gdb-get-source-buffer):=20New=20function,=20extracted=20out=20of=0A= 'gdb-restore-window'.=0A(gdb-setup-windows):=20Add=20a=20condition=20= branch=20that=20loads=20default=20window=0Aconfiguration=20when=20= available.=20=20Fix=20docstring.=0A(gdb-buffer-p,=20= gdb-function-buffer-p,=20gdb--buffer-type,=0A= gdb-save-window-configuration,=20gdb-load-window-configuration):=20New=0A= functions.=0A(gdb-restore-windows):=20Edit=20docstring=20to=20mention=0A= 'gdb-default-window-configuration-file'=20and=20add=20comments.=0A= (gdb-reset):=20Restore=20window=20configuration=20after=20quit.=0A= (gdb-get-source-file):=20Add=20comments.=0A*=20lisp/window.el=20= (with-window-non-dedicated):=20New=20macro.=0A---=0A=20= lisp/progmodes/gdb-mi.el=20|=20292=20= +++++++++++++++++++++++++++++++++------=0A=20lisp/window.el=20=20=20=20=20= =20=20=20=20=20=20|=20=2018=20+++=0A=202=20files=20changed,=20271=20= insertions(+),=2039=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0Aindex=20= da5a2a503a..686c2e5206=20100644=0A---=20a/lisp/progmodes/gdb-mi.el=0A+++=20= b/lisp/progmodes/gdb-mi.el=0A@@=20-92,6=20+92,8=20@@=0A=20(require=20= 'json)=0A=20(require=20'bindat)=0A=20(require=20'cl-lib)=0A+(require=20= 'cl-seq)=0A+(eval-when-compile=20(require=20'pcase))=0A=20=0A=20= (declare-function=20speedbar-change-initial-expansion-list=0A=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"speedbar"=20(new-default))=0A= @@=20-253,6=20+255,25=20@@=20gdb-output-sink=0A=20=09=20=20=20=20=20=20=20= disposition=20of=20output=20generated=20by=20commands=20that=0A=20=09=20=20= =20=20=20=20=20gdb=20mode=20sends=20to=20gdb=20on=20its=20own=20= behalf.")=0A=20=0A+(defvar=20gdb--window-configuration-before=20nil=0A+=20= =20"Stores=20the=20window=20configuration=20before=20starting=20gdb.")=0A= +=0A+(defcustom=20gdb-restore-window-configuration-after-quit=20nil=0A+=20= =20"If=20non-nil,=20restore=20the=20window=20configuration=20the=20user=20= had=20before=20gdb=20starts.=0A+=0A+Possible=20values=20are:=0A+=20=20=20= =20t=20--=20Always=20restore.=0A+=20=20=20=20nil=20--=20Don't=20restore.=0A= +=20=20=20=20`if-gdb-show-main'=20--=20Restore=20only=20if=20variable=20= `gdb-show-main'=20is=20non-nil=0A+=20=20=20=20`if-gdb-many-windows'=20--=20= Restore=20only=20if=20variable=20`gdb-many-windows'=20is=20non-nil."=0A+=20= =20:type=20'(choice=0A+=20=20=20=20=20=20=20=20=20=20(const=20:tag=20= "Always=20restore"=20t)=0A+=20=20=20=20=20=20=20=20=20=20(const=20:tag=20= "Don't=20restore"=20nil)=0A+=20=20=20=20=20=20=20=20=20=20(const=20:tag=20= "Depends=20on=20`gdb-show-main'"=20'if-gdb-show-main)=0A+=20=20=20=20=20=20= =20=20=20=20(const=20:tag=20"Depends=20on=20`gdb-many-windows'"=20= 'if-gdb-many-windows))=0A+=20=20:group=20'gdb=0A+=20=20:version=20= "28.1")=0A+=0A=20(defcustom=20gdb-discard-unordered-replies=20t=0A=20=20=20= "Non-nil=20means=20discard=20any=20out-of-order=20GDB=20replies.=0A=20= This=20protects=20against=20lost=20GDB=20replies,=20assuming=20that=20= GDB=20always=0A@@=20-603,6=20+624,26=20@@=20gdb-show-main=0A=20=20=20= :group=20'gdb=0A=20=20=20:version=20"22.1")=0A=20=0A+(defcustom=20= gdb-window-configuration-directory=20user-emacs-directory=0A+=20=20"The=20= default=20directory=20where=20window=20configuration=20files=20are=20= stored.=0A+If=20nil,=20use=20`default-directory'."=0A+=20=20:type=20= 'string=0A+=20=20:group=20'gdb=0A+=20=20:version=20"28.1")=0A+=0A= +(defcustom=20gdb-default-window-configuration-file=20nil=0A+=20=20"If=20= non-nil,=20GDB=20loads=20this=20window=20configuration=20(layout)=20file=20= on=20startup.=0A+=0A+This=20should=20be=20the=20path=20to=20the=20window=20= configuration=20file.=20=20If=20the=20path=0A+is=20not=20an=20absolute=20= path,=20GDB=20treats=20it=20as=20a=20relative=20path=20and=0A+looks=20= under=20`gdb-window-configuration-directory'.=0A+=0A+Note=20that=20this=20= variable=20only=20takes=20effect=20when=20variable=0A+`gdb-many-windows'=20= is=20t."=0A+=20=20:type=20'string=0A+=20=20:group=20'gdb=0A+=20=20= :version=20"28.1")=0A+=0A=20(defvar=20gdbmi-debug-mode=20nil=0A=20=20=20= "When=20non-nil,=20print=20the=20messages=20sent/received=20from=20= GDB/MI=20in=20*Messages*.")=0A=20=0A@@=20-761,6=20+802,12=20@@=20gdb=0A=20= =20=20=20=20(gdb-restore-windows)=0A=20=20=20=20=20(error=0A=20=20=20=20=20= =20"Multiple=20debugging=20requires=20restarting=20in=20text=20command=20= mode"))=0A+=0A+=20=20;;=20Save=20window=20configuration=20before=20= starting=20gdb=20so=20we=20can=20restore=0A+=20=20;;=20it=20after=20gdb=20= quits.=20Save=20it=20regardless=20of=20the=20value=20of=0A+=20=20;;=20= `gdb-restore-window-configuration-after-quit'.=0A+=20=20(setq=20= gdb--window-configuration-before=20(window-state-get))=0A+=0A=20=20=20;;=0A= =20=20=20(gud-common-init=20command-line=20nil=20= 'gud-gdbmi-marker-filter)=0A=20=0A@@=20-4491,6=20+4538,26=20@@=20= gdb-preempt-existing-or-display-buffer=0A=20=20=20(define-key=20= gud-menu-map=20[displays]=0A=20=20=20=20=20`(menu-item=20"GDB-Windows"=20= ,menu=0A=20=09=09:visible=20(eq=20gud-minor-mode=20'gdbmi)))=0A+=20=20= (define-key=20menu=20[gdb-restore-windows]=0A+=20=20=20=20'(menu-item=20= "Restore=20Initial=20Layout"=20gdb-restore-windows=0A+=20=20=20=20=20=20= :help=20"Restore=20the=20initial=20GDB=20window=20layout."))=0A+=20=20;;=20= Window=20layout=20vs=20window=20configuration:=20We=20use=20"window=20= layout"=20in=0A+=20=20;;=20GDB=20UI.=20=20Internally=20we=20refer=20to=20= "window=20configuration"=20because=0A+=20=20;;=20that's=20the=20data=20= structure=20used=20to=20store=20window=20layouts.=20=20Though=0A+=20=20= ;;=20bare=20in=20mind=20that=20there=20is=20a=20small=20difference=20= between=20what=20we=0A+=20=20;;=20store=20and=20what=20normal=20window=20= configuration=20functions=0A+=20=20;;=20output.=20Because=20GDB=20= buffers=20(source,=20local,=20breakpoint,=20etc)=20are=0A+=20=20;;=20= different=20between=20each=20debugging=20sessions,=20simply=20save/load=0A= +=20=20;;=20window=20configurations=20doesn't=0A+=20=20;;=20work.=20= `gdb-save-window-configuration'=20and=0A+=20=20;;=20= `gdb-load-window-configuration'=20do=20some=20tricks=20to=20store=20and=0A= +=20=20;;=20recreate=20each=20buffer=20in=20the=20layout.=0A+=20=20= (define-key=20menu=20[load-layout]=20'("Load=20Layout"=20"Load=20GDB=20= window=20configuration=20(layout)=20from=20a=20file"=20.=20= gdb-load-window-configuration))=0A+=20=20(define-key=20menu=20= [save-layout]=20'("Save=20Layout"=20"Save=20current=20GDB=20window=20= configuration=20(layout)=20to=20a=20file"=20.=20= gdb-save-window-configuration))=0A+=20=20(define-key=20menu=20= [restore-layout-after-quit]=0A+=20=20=20=20'(menu-item=20"Restore=20= Layout=20After=20Quit"=20gdb-toggle-restore-window-configuration=0A+=20=20= =20=20=20=20=20:button=20(:toggle=20.=20= gdb-restore-window-configuration-after-quit)=0A+=20=20=20=20=20=20=20= :help=20"Toggle=20between=20always=20restore=20the=20window=20= configuration=20(layout)=20after=20GDB=20quits=20and=20never=20= restore.\n=20You=20can=20also=20change=20this=20setting=20in=20Customize=20= to=20conditionally=20restore."))=0A=20=20=20(define-key=20menu=20[gdb]=20= '("Gdb"=20.=20gdb-display-gdb-buffer))=0A=20=20=20(define-key=20menu=20= [threads]=20'("Threads"=20.=20gdb-display-threads-buffer))=0A=20=20=20= (define-key=20menu=20[memory]=20'("Memory"=20.=20= gdb-display-memory-buffer))=0A@@=20-4529,9=20+4596,6=20@@=20= gdb-preempt-existing-or-display-buffer=0A=20=20=20=20=20'(menu-item=20= "Display=20Other=20Windows"=20gdb-many-windows=0A=20=20=20=20=20=20=20= :help=20"Toggle=20display=20of=20locals,=20stack=20and=20breakpoint=20= information"=0A=20=20=20=20=20=20=20:button=20(:toggle=20.=20= gdb-many-windows)))=0A-=20=20(define-key=20menu=20[gdb-restore-windows]=0A= -=20=20=20=20'(menu-item=20"Restore=20Window=20Layout"=20= gdb-restore-windows=0A-=20=20=20=20=20=20:help=20"Restore=20standard=20= layout=20for=20debug=20session."))=0A=20=20=20(define-key=20menu=20= [sep1]=0A=20=20=20=20=20'(menu-item=20"--"))=0A=20=20=20(define-key=20= menu=20[all-threads]=0A@@=20-4606,41=20+4670,174=20@@=20= gdb-set-window-buffer=0A=20=20=20(set-window-buffer=20window=20= (get-buffer=20name))=0A=20=20=20(set-window-dedicated-p=20window=20t))=0A= =20=0A+(defun=20gdb-toggle-restore-window-configuration=20()=0A+=20=20= "Toggle=20whether=20to=20restore=20window=20configuration=20when=20GDB=20= quits."=0A+=20=20(interactive)=0A+=20=20(setq=20= gdb-restore-window-configuration-after-quit=0A+=20=20=20=20=20=20=20=20= (not=20gdb-restore-window-configuration-after-quit)))=0A+=0A+(defun=20= gdb-get-source-buffer=20()=0A+=20=20"Return=20a=20buffer=20displaying=20= source=20file=20or=20nil=20if=20we=20can't=20find=20one.=0A+=0A+The=20= source=20file=20is=20the=20file=20that=20contains=20the=20source=20= location=0A+where=20GDB=20stops.=20=20There=20could=20be=20multiple=20= source=20files=20during=20a=0A+debugging=20session,=20we=20get=20the=20= most=20recently=20showed=20one.=20=20If=0A+program=20hasn't=20started=20= running=20yet,=20the=20source=20file=20is=20the=20\"main=0A+file\"=20= where=20the=20GDB=20session=20starts=20(see=20`gdb-main-file')."=0A+=20=20= (if=20gud-last-last-frame=0A+=20=20=20=20=20=20(gud-find-file=20(car=20= gud-last-last-frame))=0A+=20=20=20=20(when=20gdb-main-file=0A+=20=20=20=20= =20=20(gud-find-file=20gdb-main-file))))=0A+=0A=20(defun=20= gdb-setup-windows=20()=0A-=20=20"Layout=20the=20window=20pattern=20for=20= option=20`gdb-many-windows'."=0A-=20=20(gdb-get-buffer-create=20= 'gdb-locals-buffer)=0A-=20=20(gdb-get-buffer-create=20'gdb-stack-buffer)=0A= -=20=20(gdb-get-buffer-create=20'gdb-breakpoints-buffer)=0A-=20=20= (set-window-dedicated-p=20(selected-window)=20nil)=0A-=20=20= (switch-to-buffer=20gud-comint-buffer)=0A-=20=20(delete-other-windows)=0A= -=20=20(let=20((win0=20(selected-window))=0A-=20=20=20=20=20=20=20=20= (win1=20(split-window=20nil=20(=20/=20(=20*=20(window-height)=203)=20= 4)))=0A-=20=20=20=20=20=20=20=20(win2=20(split-window=20nil=20(=20/=20= (window-height)=203)))=0A-=20=20=20=20=20=20=20=20(win3=20= (split-window-right)))=0A-=20=20=20=20(gdb-set-window-buffer=20= (gdb-locals-buffer-name)=20nil=20win3)=0A-=20=20=20=20(select-window=20= win2)=0A-=20=20=20=20(set-window-buffer=0A-=20=20=20=20=20win2=0A-=20=20=20= =20=20(if=20gud-last-last-frame=0A-=20=20=20=20=20=20=20=20=20= (gud-find-file=20(car=20gud-last-last-frame))=0A-=20=20=20=20=20=20=20= (if=20gdb-main-file=0A-=20=20=20=20=20=20=20=20=20=20=20(gud-find-file=20= gdb-main-file)=0A-=20=20=20=20=20=20=20=20=20;;=20Put=20buffer=20list=20= in=20window=20if=20we=0A-=20=20=20=20=20=20=20=20=20;;=20can't=20find=20= a=20source=20file.=0A-=20=20=20=20=20=20=20=20=20= (list-buffers-noselect))))=0A-=20=20=20=20(setq=20gdb-source-window=20= (selected-window))=0A-=20=20=20=20(let=20((win4=20(split-window-right)))=0A= -=20=20=20=20=20=20(gdb-set-window-buffer=0A-=20=20=20=20=20=20=20= (gdb-get-buffer-create=20'gdb-inferior-io)=20nil=20win4))=0A-=20=20=20=20= (select-window=20win1)=0A-=20=20=20=20(gdb-set-window-buffer=20= (gdb-stack-buffer-name))=0A-=20=20=20=20(let=20((win5=20= (split-window-right)))=0A-=20=20=20=20=20=20(gdb-set-window-buffer=20(if=20= gdb-show-threads-by-default=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (gdb-threads-buffer-name)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (gdb-breakpoints-buffer-name))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20win5))=0A-=20=20=20= =20(select-window=20win0)))=0A+=20=20"Lay=20out=20the=20window=20pattern=20= for=20option=20`gdb-many-windows'."=0A+=20=20(if=20= gdb-default-window-configuration-file=0A+=20=20=20=20=20=20= (gdb-load-window-configuration=0A+=20=20=20=20=20=20=20(if=20= (file-name-absolute-p=20gdb-default-window-configuration-file)=0A+=20=20=20= =20=20=20=20=20=20=20=20gdb-default-window-configuration-file=0A+=20=20=20= =20=20=20=20=20=20(expand-file-name=20= gdb-default-window-configuration-file=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= gdb-window-configuration-directory)))=0A+=20=20=20=20;;=20Create=20= efault=20layout=20as=20before.=0A+=20=20=20=20(gdb-get-buffer-create=20= 'gdb-locals-buffer)=0A+=20=20=20=20(gdb-get-buffer-create=20= 'gdb-stack-buffer)=0A+=20=20=20=20(gdb-get-buffer-create=20= 'gdb-breakpoints-buffer)=0A+=20=20=20=20(set-window-dedicated-p=20= (selected-window)=20nil)=0A+=20=20=20=20(switch-to-buffer=20= gud-comint-buffer)=0A+=20=20=20=20(delete-other-windows)=0A+=20=20=20=20= (let=20((win0=20(selected-window))=0A+=20=20=20=20=20=20=20=20=20=20= (win1=20(split-window=20nil=20(=20/=20(=20*=20(window-height)=203)=20= 4)))=0A+=20=20=20=20=20=20=20=20=20=20(win2=20(split-window=20nil=20(=20= /=20(window-height)=203)))=0A+=20=20=20=20=20=20=20=20=20=20(win3=20= (split-window-right)))=0A+=20=20=20=20=20=20(gdb-set-window-buffer=20= (gdb-locals-buffer-name)=20nil=20win3)=0A+=20=20=20=20=20=20= (select-window=20win2)=0A+=20=20=20=20=20=20(set-window-buffer=20win2=20= (or=20(gdb-get-source-buffer)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (list-buffers-noselect)))=0A+=20=20=20=20=20=20(setq=20gdb-source-window=20= (selected-window))=0A+=20=20=20=20=20=20(let=20((win4=20= (split-window-right)))=0A+=20=20=20=20=20=20=20=20(gdb-set-window-buffer=0A= +=20=20=20=20=20=20=20=20=20(gdb-get-buffer-create=20'gdb-inferior-io)=20= nil=20win4))=0A+=20=20=20=20=20=20(select-window=20win1)=0A+=20=20=20=20=20= =20(gdb-set-window-buffer=20(gdb-stack-buffer-name))=0A+=20=20=20=20=20=20= (let=20((win5=20(split-window-right)))=0A+=20=20=20=20=20=20=20=20= (gdb-set-window-buffer=20(if=20gdb-show-threads-by-default=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(gdb-threads-buffer-name)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (gdb-breakpoints-buffer-name))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20win5))=0A+=20= =20=20=20=20=20(select-window=20win0))))=0A+=0A+(defun=20gdb-buffer-p=20= (buffer)=0A+=20=20"Return=20t=20if=20BUFFER=20is=20GDB-related."=0A+=20=20= (with-current-buffer=20buffer=0A+=20=20=20=20(eq=20gud-minor-mode=20= 'gdbmi)))=0A+=0A+(defun=20gdb-function-buffer-p=20(buffer)=0A+=20=20= "Return=20t=20if=20BUFFER=20is=20a=20GDB=20function=20buffer.=0A+=0A= +Function=20buffers=20are=20locals=20buffer,=20registers=20buffer,=20= etc,=20but=0A+not=20including=20main=20command=20buffer=20(the=20one=20= where=20you=20type=20GDB=0A+commands)=20or=20source=20buffers=20(that=20= display=20program=20source=20code)."=0A+=20=20(with-current-buffer=20= buffer=0A+=20=20=20=20(derived-mode-p=20'gdb-parent-mode=20= 'gdb-inferior-io-mode)))=0A+=0A+(defun=20gdb--buffer-type=20(buffer)=0A+=20= =20"Return=20the=20type=20of=20BUFFER=20if=20it=20is=20a=20function=20= buffer.=0A+=0A+Buffer=20type=20is=20like=20`gdb-registers-type',=20= `gdb-stack-buffer'.=0A+These=20symbols=20are=20used=20by=20= `gdb-get-buffer-create'.=0A+=0A+Return=20nil=20if=20BUFFER=20isn't=20a=20= GDB=20function=20buffer."=0A+=20=20(with-current-buffer=20buffer=0A+=20=20= =20=20(cl-loop=20for=20rule=20in=20gdb-buffer-rules=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20for=20mode-name=20=3D=20(gdb-rules-buffer-mode=20= rule)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20for=20type=20=3D=20(car=20= rule)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20if=20(eq=20mode-name=20= major-mode)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20return=20type=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20finally=20return=20nil)))=0A+=0A= +(defun=20gdb-save-window-configuration=20(file)=0A+=20=20"Save=20= current=20window=20configuration=20(layout)=20to=20FILE.=0A+=0A+You=20= can=20later=20restore=20this=20configuration=20from=20that=20file=20by=0A= +`gdb-load-window-configuration'."=0A+=20=20(interactive=20(list=20= (read-file-name=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"Save=20window=20configuration=20to=20file:=20"=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20= gdb-window-configuration-directory=20default-directory))))=0A+=20=20;;=20= We=20replace=20the=20buffer=20in=20each=20window=20with=20a=20= placeholder,=20store=0A+=20=20;;=20the=20buffer=20type=20(register,=20= breakpoint,=20etc)=20in=20window=20parameters,=0A+=20=20;;=20and=20write=20= the=20window=20configuration=20to=20the=20file.=0A+=20=20= (save-window-excursion=0A+=20=20=20=20(let=20((placeholder=20= (get-buffer-create=20"=20*gdb-placeholder*"))=0A+=20=20=20=20=20=20=20=20= =20=20(window-persistent-parameters=0A+=20=20=20=20=20=20=20=20=20=20=20= (cons=20'(gdb-buffer-type=20.=20writable)=20= window-persistent-parameters)))=0A+=20=20=20=20=20=20(unwind-protect=0A+=20= =20=20=20=20=20=20=20=20=20(dolist=20(win=20(window-list=20nil=20= 'no-minibuffer))=0A+=20=20=20=20=20=20=20=20=20=20=20=20(select-window=20= win)=0A+=20=20=20=20=20=20=20=20=20=20=20=20(when=20(gdb-buffer-p=20= (current-buffer))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (set-window-parameter=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= nil=20'gdb-buffer-type=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (cond=20((gdb-function-buffer-p=20(current-buffer))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=201)=20If=20a=20user=20= arranged=20the=20window=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20;;=20configuration=20herself=20and=20saves=20it,=20= windows=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20;;=20are=20probably=20not=20dedicated.=20=202)=20We=20use=20the=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20same=20= dedication=20flag=20as=20in=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20;;=20`gdb-display-buffer'.=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(set-window-dedicated-p=20= nil=20t)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20;;=20We=20save=20this=20gdb-buffer-type=20symbol=20so=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20we=20can=20later=20= pass=20it=20to=20`gdb-get-buffer-create';=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20;;=20one=20example:=20= `gdb-registers-buffer'.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(or=20(gdb--buffer-type=20(current-buffer))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20"Unrecognized=20gdb=20buffer=20mode:=20%s"=20major-mode)))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Command=20= buffer.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ((derived-mode-p=20'gud-mode)=20'command)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20((equal=20(selected-window)=20= gdb-source-window)=20'source)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(with-window-non-dedicated=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(set-window-buffer=20nil=20placeholder)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(set-window-prev-buffers=20= (selected-window)=20nil)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(set-window-next-buffers=20(selected-window)=20nil))))=0A+=20=20=20=20= =20=20=20=20;;=20Save=20the=20window=20configuration=20to=20FILE.=0A+=20=20= =20=20=20=20=20=20(let=20((window-config=20(window-state-get=20nil=20= t)))=0A+=20=20=20=20=20=20=20=20=20=20(with-temp-buffer=0A+=20=20=20=20=20= =20=20=20=20=20=20=20(prin1=20window-config=20(current-buffer))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20(write-file=20file=20t)))=0A+=20=20=20=20=20= =20=20=20(kill-buffer=20placeholder)))))=0A+=0A+(defun=20= gdb-load-window-configuration=20(file)=0A+=20=20"Restore=20window=20= configuration=20(layout)=20from=20FILE.=0A+=0A+FILE=20should=20be=20a=20= window=20configuration=20file=20saved=20by=0A= +`gdb-save-window-configuration'."=0A+=20=20(interactive=20(list=20= (read-file-name=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"Restore=20window=20configuration=20from=20file:=20"=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20= gdb-window-configuration-directory=20default-directory))))=0A+=20=20;;=20= Basically,=20we=20restore=20window=20configuration=20and=20go=20through=20= each=0A+=20=20;;=20window=20and=20restore=20the=20function=20buffers.=0A= +=20=20(let*=20((placeholder=20(get-buffer-create=20"=20= *gdb-placeholder*")))=0A+=20=20=20=20(unwind-protect=20;=20Don't=20leak=20= buffer.=0A+=20=20=20=20=20=20=20=20(let=20((window-config=20= (with-temp-buffer=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(insert-file-contents=20file)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20We=20need=20to=20go=20to=20point-min=20because=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20`read'=20reads=20from=20point=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (goto-char=20(point-min))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(read=20= (current-buffer))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (source-buffer=20(or=20(gdb-get-source-buffer)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20Do=20the=20same=20thing=20as=20in=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= `gdb-setup-windows'=20if=20no=20source=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= buffer=20is=20found.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (list-buffers-noselect)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= buffer-type)=0A+=20=20=20=20=20=20=20=20=20=20(window-state-put=20= window-config=20(frame-root-window))=0A+=20=20=20=20=20=20=20=20=20=20= (dolist=20(window=20(window-list=20nil=20'no-minibuffer))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20(with-selected-window=20window=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(setq=20buffer-type=20(window-parameter=20nil=20= 'gdb-buffer-type))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(pcase=20= buffer-type=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20('source=20= (when=20source-buffer=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(set-window-buffer=20nil=20= source-buffer)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(setq=20gdb-source-window=20(selected-window))))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20('command=20= (switch-to-buffer=20gud-comint-buffer))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(_=20(let=20((buffer=20(gdb-get-buffer-create=20= buffer-type)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(with-window-non-dedicated=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(set-window-buffer=20nil=20= buffer))))))))=0A+=20=20=20=20=20=20(kill-buffer=20placeholder))))=0A=20=0A= =20(define-minor-mode=20gdb-many-windows=0A=20=20=20"If=20nil=20just=20= pop=20up=20the=20GUD=20buffer=20unless=20`gdb-show-main'=20is=20t.=0A@@=20= -4658,7=20+4855,12=20@@=20gdb-many-windows=0A=20=0A=20(defun=20= gdb-restore-windows=20()=0A=20=20=20"Restore=20the=20basic=20arrangement=20= of=20windows=20used=20by=20gdb.=0A-This=20arrangement=20depends=20on=20= the=20value=20of=20option=20`gdb-many-windows'."=0A+This=20arrangement=20= depends=20on=20the=20values=20of=20variable=0A+`gdb-many-windows'=20and=20= `gdb-default-window-configuration-file'."=0A+=20=20;;=20This=20function=20= is=20used=20when=20the=20user=20messed=20up=20window=0A+=20=20;;=20= configuration=20and=20wants=20to=20"reset=20to=20default".=20=20The=20= function=20that=0A+=20=20;;=20sets=20up=20window=20configuration=20on=20= start=20up=20is=0A+=20=20;;=20`gdb-get-source-file'.=0A=20=20=20= (interactive)=0A=20=20=20(switch-to-buffer=20gud-comint-buffer)=20= ;Select=20the=20right=20window=20and=20frame.=0A=20=20=20= (delete-other-windows)=0A@@=20-4705,11=20+4907,23=20@@=20gdb-reset=0A=20=20= =20(if=20(boundp=20'speedbar-frame)=20(speedbar-timer-fn))=0A=20=20=20= (setq=20gud-running=20nil)=0A=20=20=20(setq=20gdb-active-process=20nil)=0A= -=20=20(remove-hook=20'after-save-hook=20'gdb-create-define-alist=20t))=0A= +=20=20(remove-hook=20'after-save-hook=20'gdb-create-define-alist=20t)=0A= +=20=20;;=20Recover=20window=20configuration.=0A+=20=20(when=20(or=20(eq=20= gdb-restore-window-configuration-after-quit=20t)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20(and=20(eq=20gdb-restore-window-configuration-after-quit=20= 'if-gdb-show-main)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= gdb-show-main)=0A+=20=20=20=20=20=20=20=20=20=20=20=20(and=20(eq=20= gdb-restore-window-configuration-after-quit=20'if-gdb-many-windows)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20gdb-many-windows))=0A+=20= =20=20=20(when=20gdb--window-configuration-before=0A+=20=20=20=20=20=20= (window-state-put=20gdb--window-configuration-before)=0A+=20=20=20=20=20=20= ;;=20This=20way=20we=20don't=20accidentally=20restore=20an=20outdated=20= window=0A+=20=20=20=20=20=20;;=20configuration.=0A+=20=20=20=20=20=20= (setq=20gdb--window-configuration-before=20nil))))=0A=20=0A=20(defun=20= gdb-get-source-file=20()=0A=20=20=20"Find=20the=20source=20file=20where=20= the=20program=20starts=20and=20display=20it=20with=20related=0A=20= buffers,=20if=20required."=0A+=20=20;;=20This=20function=20is=20called=20= only=20once=20on=20startup.=0A=20=20=20(goto-char=20(point-min))=0A=20=20= =20(if=20(re-search-forward=20gdb-source-file-regexp=20nil=20t)=0A=20=20=20= =20=20=20=20(setq=20gdb-main-file=20(read=20(match-string=201))))=0Adiff=20= --git=20a/lisp/window.el=20b/lisp/window.el=0Aindex=20= bd825c09e1..db552f4b4d=20100644=0A---=20a/lisp/window.el=0A+++=20= b/lisp/window.el=0A@@=20-278,6=20+278,24=20@@=20= with-displayed-buffer-window=0A=20=09=20=20=20=20=20(funcall=20= ,vquit-function=20,window=20,value)=0A=20=09=20=20=20,value)))))=0A=20=0A= +(defmacro=20with-window-non-dedicated=20(window=20&rest=20body)=0A+=20=20= "Evaluate=20BODY=20with=20WINDOW=20temporarily=20made=20non-dedicated.=0A= +=0A+If=20WINDOW=20is=20nil,=20use=20the=20selected=20window.=20=20= Return=20the=20value=20of=20the=20last=20form=20in=20BODY."=0A+=20=20= (declare=20(indent=201)=20(debug=20t))=0A+=20=20(let=20= ((window-dedicated-sym=20(gensym))=0A+=20=20=20=20=20=20=20=20= (window-sym=20(gensym)))=0A+=20=20=20=20`(let*=20((,window-sym=20= (window-normalize-window=20,window=20t))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20(,window-dedicated-sym=20(window-dedicated-p=20,window-sym)))=0A+=20= =20=20=20=20=20=20(set-window-dedicated-p=20,window-sym=20nil)=0A+=20=20=20= =20=20=20=20(unwind-protect=0A+=20=20=20=20=20=20=20=20=20=20=20(progn=20= ,@body)=0A+=20=20=20=20=20=20=20=20=20;;=20`window-dedicated-p'=20= returns=20the=20value=20set=20by=0A+=20=20=20=20=20=20=20=20=20;;=20= `set-window-dedicated-p',=20which=20differentiates=20non-nil=20and=0A+=20= =20=20=20=20=20=20=20=20;;=20t,=20so=20we=20cannot=20simply=20use=20t=20= here.=20That's=20why=20we=20use=0A+=20=20=20=20=20=20=20=20=20;;=20= `window-dedicated-sym'.=0A+=20=20=20=20=20=20=20=20=20= (set-window-dedicated-p=20,window-sym=20,window-dedicated-sym)))))=0A+=0A= =20;;=20The=20following=20two=20functions=20are=20like=20= `window-next-sibling'=20and=0A=20;;=20`window-prev-sibling'=20but=20the=20= WINDOW=20argument=20is=20_not_=20optional=20(so=0A=20;;=20they=20don't=20= substitute=20the=20selected=20window=20for=20nil),=20and=20they=20return=0A= --=20=0A2.25.1=0A=0A= --Apple-Mail=_9629F9EB-298F-4520-A2A2-F7CA5EE269BA Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_9629F9EB-298F-4520-A2A2-F7CA5EE269BA--