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 16:09:06 -0400 Message-ID: <301E3A87-7ED6-4E0A-A6DA-ABF84EB85B2F@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> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_B0F56DFC-15AB-4638-BC9F-4D248EC1057C" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="35570"; 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 21:10:16 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 1jCqdL-00096o-9N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 21:10:15 +0100 Original-Received: from localhost ([::1]:36404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCqdK-0007cf-5O for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Mar 2020 16:10:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47573) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCqdA-0007cW-3E for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 16:10:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCqd8-0005Yf-Up for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 16:10:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCqd8-0005XZ-MU for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 16:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCqd8-0005am-F6 for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2020 16:10: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 20:10:02 +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.158413015621436 (code B ref 39181); Fri, 13 Mar 2020 20:10:02 +0000 Original-Received: (at 39181) by debbugs.gnu.org; 13 Mar 2020 20:09:16 +0000 Original-Received: from localhost ([127.0.0.1]:60269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCqcO-0005Zg-Dk for submit@debbugs.gnu.org; Fri, 13 Mar 2020 16:09:16 -0400 Original-Received: from mail-qk1-f177.google.com ([209.85.222.177]:37504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCqcM-0005ZO-BC for 39181@debbugs.gnu.org; Fri, 13 Mar 2020 16:09:14 -0400 Original-Received: by mail-qk1-f177.google.com with SMTP id z25so9907248qkj.4 for <39181@debbugs.gnu.org>; Fri, 13 Mar 2020 13:09:14 -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=hhC992VrgmYvF+v418x3RnbxjtN6hIwPyRZI8u5+6qQ=; b=lzIkQniQ3zor08tCZnVKJSEAlBzLRLy2zbmg5xjo3HSfFoL6E+dE3jLBzZuJ2gL47h t46f+WO5ajkDyDZ0V5Pr0/Z9TadXOQQKw0ozaLGTLjsPncunSo7Xt9N/AW/TkkXLv/Lk 2+UeP7kchObzhZJfXLv2IIDs8hpq6Ddg9vGvGXBrUcBu7vOdDXMazFTQyYKy9KvlodO0 7E5FB4f4JUw8R1OjDjlquoIrO9bFKZIAGjYaonOGu8jdkyzUN8VvzVNONT17LxN4yjTS Jn8lQchn+2s6vk0R5zjrTQPNFe8/mGMKvdBw5UKTs7pNVNu35avHQDMNO3Ro/PUecK1w WzmQ== 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=hhC992VrgmYvF+v418x3RnbxjtN6hIwPyRZI8u5+6qQ=; b=NhTB0ws/iU3/jpQEihxlSB9aMUEFn+KWp0bdySoCHvCsBRIMEIXtB/EOiBmN2qL+GV K3J25P86IF2Dy6qcuhfHxIijoVDvhrusGvujxZ6gVmRBk0+yu/o/41O+rkR+QMApo1pb Pp9+2cRcW/JC137mK/h2d1tBskR0E4y1O9Ia06ol+dL7fqg9QLIsvXc02puFeKTjBRrN ORCpr7+vB5dDydeeDGarHNFpyTcvalQCO1m69ZRFfXH5ysuGePZPZzjceDijL0PlP8O7 ZWy8PKpV3osAhaYngnsmJFuxnXXyqC+D3iQ+BWlzZJt6glM4qLigQ9Nm2dy//cg1RDCe WmrA== X-Gm-Message-State: ANhLgQ1dA4E9rOFIBUZaPQo7LCIhSE3LBE8I3Vmb9B9ttzzaI0G2kjXG uksLTrspSjxX1ZJDKkXZXvM= X-Google-Smtp-Source: ADFU+vtG+JaAipP8wKglhrI85Y3YQACuOz2qTPmAmlsMK8G2263gNewvNGGhlCRsSUKqShY65v0pGQ== X-Received: by 2002:a37:884:: with SMTP id 126mr14383979qki.72.1584130148820; Fri, 13 Mar 2020 13:09:08 -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 m6sm5060997qkh.33.2020.03.13.13.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2020 13:09:07 -0700 (PDT) In-Reply-To: <0EF37881-F1DA-48AD-8F4E-05A37041BD98@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:177297 Archived-At: --Apple-Mail=_B0F56DFC-15AB-4638-BC9F-4D248EC1057C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Here=E2=80=99s the patch that addresses =C5=A0t=C4=9Bp=C3=A1n and = Martin=E2=80=99s review: Apart from fixing all the mentioned issues, I also moved =E2=80=9CRestore = Window Layout=E2=80=9D button from =E2=80=9CGDB-MI=E2=80=9D menu to = =E2=80=9CGDB-WINDOWS=E2=80=9D menu, since it fits there better; I also = mentioned that this button works for the new user-supplied default = layout, too, if a user sets `gdb-default-window-configuration-file=E2=80=99= .=20 As for the layout vs configuration, I used =E2=80=9Clayout=E2=80=9D in = UI buttons, and used =E2=80=9Cwindow configuration (i.e. window = layout)=E2=80=9D in help echos. Hopefully the user will understand that = we use =E2=80=9Cwindow configuration=E2=80=9D internally but it=E2=80=99s = (almost) the same as a window layout in gdb. This also plays well with = existing UI that uses =E2=80=9Clayout=E2=80=9D. 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. Martin suggests to mention the layout vs window configuration in the = manual, should I also document this new feature in the same section? = (Let me learn texinfo first ;-) Yuan --Apple-Mail=_B0F56DFC-15AB-4638-BC9F-4D248EC1057C Content-Type: multipart/mixed; boundary="Apple-Mail=_BBA7F43D-DAB4-4458-A837-BCB492859B7F" --Apple-Mail=_BBA7F43D-DAB4-4458-A837-BCB492859B7F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Here=E2=80=99s the = patch that addresses =C5=A0t=C4=9Bp=C3=A1n and Martin=E2=80=99s review:

Apart from fixing all = the mentioned issues, I also moved =E2=80=9CRestore Window Layout=E2=80=9D= button from =E2=80=9CGDB-MI=E2=80=9D menu to =E2=80=9CGDB-WINDOWS=E2=80=9D= menu, since it fits there better; I also mentioned that this button = works for the new user-supplied default layout, too, if a user sets = `gdb-default-window-configuration-file=E2=80=99. 

As for the layout vs = configuration, I used =E2=80=9Clayout=E2=80=9D in UI buttons, and used = =E2=80=9Cwindow configuration (i.e. window layout)=E2=80=9D in help = echos. Hopefully the user will understand that we use =E2=80=9Cwindow = configuration=E2=80=9D internally but it=E2=80=99s (almost) the same as = a window layout in gdb. This also plays well with existing UI that uses = =E2=80=9Clayout=E2=80=9D. 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.

Martin = suggests to mention the layout vs window configuration in the manual, = should I also document this new feature in the same section? (Let me = learn texinfo first ;-)

Yuan

= --Apple-Mail=_BBA7F43D-DAB4-4458-A837-BCB492859B7F 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=2059590d8a8b21908cefc10787029a6db1ae5fdfef=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.=0A(gdb-buffer-p,=20gdb-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|=20279=20= +++++++++++++++++++++++++++++++++------=0A=20lisp/window.el=20=20=20=20=20= =20=20=20=20=20=20|=20=2018=20+++=0A=202=20files=20changed,=20259=20= insertions(+),=2038=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0Aindex=20= da5a2a503a..e1a2993b4e=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"Whether=20to=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=20file=20on=20= startup.=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,15=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=20Default=20Layout"=20gdb-restore-windows=0A+=20=20=20=20=20=20= :help=20"Restore=20standard=20layout=20for=20debug=20session.=20I.e.,=20= the=20layout=20we=20get=20when=20session=20starts."))=0A+=20=20= (define-key=20menu=20[load-layout]=20'("Load=20Layout"=20"Load=20GDB=20= window=20configuration=20(i.e.=20window=20layout)=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(i.e.=20window=20layout)=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(i.e.=20window=20layout)=20after=20GDB=20quits=20and=20= never=20restore.\n=20You=20can=20also=20change=20this=20setting=20in=20= Customize=20to=20conditionally=20restore."))=0A=20=20=20(define-key=20= menu=20[gdb]=20'("Gdb"=20.=20gdb-display-gdb-buffer))=0A=20=20=20= (define-key=20menu=20[threads]=20'("Threads"=20.=20= gdb-display-threads-buffer))=0A=20=20=20(define-key=20menu=20[memory]=20= '("Memory"=20.=20gdb-display-memory-buffer))=0A@@=20-4529,9=20+4585,6=20= @@=20gdb-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+4659,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= quit."=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=20start=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=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(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= default=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(i.e.=20window=20layout)=20to=20FILE.=0A= +=0A+You=20can=20later=20restore=20this=20configuration=20from=20that=20= file=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(i.e.=20window=20layout)=20from=20FILE.=0A+=0A+FILE=20= should=20be=20a=20window=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+4844,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=20value=20of=20option=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+4896,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..d774d906cd=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=20selected=20and=20temporarily=20made=20= non-dedicated.=0A+=0A+If=20WINDOW=20is=20nil,=20use=20the=20selected=20= window.=20=20Return=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=_BBA7F43D-DAB4-4458-A837-BCB492859B7F Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
--Apple-Mail=_BBA7F43D-DAB4-4458-A837-BCB492859B7F-- --Apple-Mail=_B0F56DFC-15AB-4638-BC9F-4D248EC1057C--