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: Sun, 9 Feb 2020 23:56:47 -0500 Message-ID: References: <55EA8238-880A-420D-A880-CD33B7E1DA85@gmail.com> <83lfpokk63.fsf@gnu.org> <27BC0F04-C81E-4D46-A84C-B61AAE700F59@gmail.com> <499CD0CF-DA9D-4706-9F8D-6DF6CFE752BE@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_DAB05EEB-D33C-4D29-BA1E-A72E534C599F" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="5944"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39181@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 10 06:00:22 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 1j11BG-0001T7-0c for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Feb 2020 06:00:22 +0100 Original-Received: from localhost ([::1]:56912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j11BE-0005lA-UW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Feb 2020 00:00:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49686) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1183-0001KK-LL for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 23:57:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1182-00052Q-Kp for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 23:57:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j1182-00051u-GB for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 23:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j1182-0003wl-ES for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 23:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Feb 2020 04:57: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.158131061715160 (code B ref 39181); Mon, 10 Feb 2020 04:57:02 +0000 Original-Received: (at 39181) by debbugs.gnu.org; 10 Feb 2020 04:56:57 +0000 Original-Received: from localhost ([127.0.0.1]:53561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j117w-0003wS-P3 for submit@debbugs.gnu.org; Sun, 09 Feb 2020 23:56:57 -0500 Original-Received: from mail-qk1-f182.google.com ([209.85.222.182]:40670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j117v-0003wE-56 for 39181@debbugs.gnu.org; Sun, 09 Feb 2020 23:56:55 -0500 Original-Received: by mail-qk1-f182.google.com with SMTP id b7so5329480qkl.7 for <39181@debbugs.gnu.org>; Sun, 09 Feb 2020 20:56:55 -0800 (PST) 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=NNO6ajAPNDrsqFc0HU4jggSTo5dsnvM5faO6jVOgh1Q=; b=vIhXj6kaw34igbVLnCEOw+pywwgBktafp+S6aeswpBMvgij9yzFuT3oYX+bO6CFOIM eQHhKj0OtvS6HYOWm25yyxdXM2oUPDaajRT+Sgca5Dybob02nuZrMbgZiltHD8RrWEQf IS8NYYPX8QwtNF4WRnBNThEf9T6HzmllFQoYonWV/Ug9rpW46zSdrBU7s+V+LcWaUxsO HK9lSzwkPH0ubHTHYTE2SXBE8Jp9G/rIew1YQeHauIeT75d8i+idtD1U/uxZdhYSNr5h +oh2U4IKqxGeuGe7Miie9beGNg2QXDYTLASxn8Fdm1by7qWU5OttVrJLa4IujYDuOLV3 3YRg== 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=NNO6ajAPNDrsqFc0HU4jggSTo5dsnvM5faO6jVOgh1Q=; b=WbFdbGPgLFFdF4o0INVRJDaZmOzGn3+a2YxIRLrAsv/GaFaxHy9ochVvilpDOfkEOF YN74oHU5AdfxXgDDWsjncOONPzzzn1GEl0uG+An+yO7eRHMr1NBhaC22tvuBt1TZ4m78 Iwnht92cj+Aor2Qa8JN2dTIz+eMKhvyt49c/nRKUJWZExcrYXn2Sce/aEfgDZNYN0O1H ZCyVZDram6nNNoQGRStArjPM77iZ6yE2rBGwH8MSypHsz9ulqcSTqyh+/Ss5g8TFcqCS msSt92/WkaL+6v29+d9crkehrsBLgjgEOXvGadgU8rJ3g7LqSuZBifgZ4Mkbkzhava+n /yUQ== X-Gm-Message-State: APjAAAVIJpVlEJhl2vr5iyw8/fPurPatosKrAn3Y1PumHR5NTrBngcOG m3N9DjcEvjwHlug2FcKc0ek= X-Google-Smtp-Source: APXvYqyhUSlr4lCjdTWj9O0gwh+Q8KsEIObLOsyvlSG2dYRzaMAOq96rhzPlInN6C3Bu07QxLRiGoQ== X-Received: by 2002:a05:620a:1586:: with SMTP id d6mr3864633qkk.234.1581310609519; Sun, 09 Feb 2020 20:56:49 -0800 (PST) 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 k5sm5233292qkk.117.2020.02.09.20.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Feb 2020 20:56:49 -0800 (PST) In-Reply-To: <499CD0CF-DA9D-4706-9F8D-6DF6CFE752BE@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:175855 Archived-At: --Apple-Mail=_DAB05EEB-D33C-4D29-BA1E-A72E534C599F Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii I updated my patch according to your suggestion in the memory patch. Yuan --Apple-Mail=_DAB05EEB-D33C-4D29-BA1E-A72E534C599F Content-Disposition: attachment; filename=restore-after-quit.patch Content-Type: application/octet-stream; x-unix-mode=0700; name="restore-after-quit.patch" Content-Transfer-Encoding: quoted-printable =46rom=20fcee6b9498359b089d4f99ee23cd037e615a4568=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Thu,=20= 16=20Jan=202020=2018:52:17=20-0500=0ASubject:=20[PATCH]=20Restore=20= previous=20window=20layout=20when=20gdb=20quits=0A=0AMake=20gdb=20= preserve=20the=20window=20configuration=20that=20the=20user=20had=20= before=0Astarting=20gdb.=0A*=20lisp/progmodes/gdb-mi.el=20= (gdb--window-configuration-before):=20New=0Avariable.=0A(gdb):=20Save=20= configuration=20on=20startup.=0A(gdb-reset):=20Restore=20window=20= configuration=20after=20quit.=0A---=0A=20lisp/progmodes/gdb-mi.el=20|=20= 11=20++++++++++-=0A=201=20file=20changed,=2010=20insertions(+),=201=20= deletion(-)=0A=0Adiff=20--git=20a/lisp/progmodes/gdb-mi.el=20= b/lisp/progmodes/gdb-mi.el=0Aindex=203c2eee5b73..8b5c4f2ec1=20100644=0A= ---=20a/lisp/progmodes/gdb-mi.el=0A+++=20b/lisp/progmodes/gdb-mi.el=0A@@=20= -243,6=20+243,9=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=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-762,6=20+765,10=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=0A+=20=20(setq=20gdb--window-configuration-before=20= (window-state-get))=0A=20=20=20;;=0A=20=20=20(gud-common-init=20= command-line=20nil=20'gud-gdbmi-marker-filter)=0A=20=0A@@=20-4819,7=20= +4826,9=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=20= window=20configuration=0A+=20=20(window-state-put=20= gdb--window-configuration-before))=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=0A= 2.25.0=0A=0A= --Apple-Mail=_DAB05EEB-D33C-4D29-BA1E-A72E534C599F Content-Disposition: attachment; filename=new-store-window.patch Content-Type: application/octet-stream; x-unix-mode=0700; name="new-store-window.patch" Content-Transfer-Encoding: quoted-printable =46rom=20014b52066abff85eac6b90933eec7d3aa0259fda=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Thu,=20= 17=20Oct=202019=2017:35:48=20-0400=0ASubject:=20[PATCH]=20Allow=20user=20= to=20save/load=20window=20layout=20in=20gdb-mi=0AMIME-Version:=201.0=0A= Content-Type:=20text/plain;=20charset=3DUTF-8=0A= Content-Transfer-Encoding:=208bit=0A=0AAdd=20a=20feature=20that=20allows=20= a=20user=20to=20save=20a=20gdb=20window=20layout=20to=20a=20file=0Awith=20= 'gdb-save-window-layout'=20and=20load=20it=20back=20it=20with=0A= 'gdb-load-window-layout'.=20Set=20a=20default=20window=20configuration=20= by=0Asetting=20'gdb-default-window-layout-file'.=20Note=20that=20for=20= the=20default=0Awindow=20configuration=20to=20take=20effect,=20= 'gdb-many-windows'=20needs=20to=20be=20t.=0AIn=20window.el,=20add=20= 'with-selected-window-undedicated'.=0A*=20lisp/progmodes/gdb-mi.el=20= (require):=20add=20'pcase',=20wrap=20'pcase'=20and=20'cl-lib'=0Ainside=20= =E2=80=98eval-when-compile=E2=80=99.=0A(gdb-window-layout-directory,=20= gdb-default-window-layout-file):=20New=0Avariables.=0A(gud-menu-map):=20= Add=20"Load=20window=20layout"=20and=20"Save=20window=20layout"=20to=0A= menu.=0A(gdb-get-source-buffer):=20New=20function,=20extracted=20out=20= of=0A'gdb-restore-window'.=0A(gdb-setup-windows):=20Add=20a=20condition=20= branch=20that=20loads=20default=20window=0Alayout=20when=20available.=0A= (gdb-buffer-p,=20gdb-function-buffer-p,=20gdb--buffer-type,=0A= gdb-save-window-layout,=20gdb-load-window-layout):=20New=20functions.=0A= (gdb-many-windows,=20gdb-get-source-file):=20Add=20comments.=0A*=20= lisp/window.el=20(with-selected-window-undedicated):=20New=20function.=0A= ---=0A=20lisp/progmodes/gdb-mi.el=20|=20217=20= +++++++++++++++++++++++++++++++++------=0A=20lisp/window.el=20=20=20=20=20= =20=20=20=20=20=20|=20=2013=20+++=0A=202=20files=20changed,=20196=20= insertions(+),=2034=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0Aindex=20= b08d487af3..8c7e81d727=20100644=0A---=20a/lisp/progmodes/gdb-mi.el=0A+++=20= b/lisp/progmodes/gdb-mi.el=0A@@=20-91,7=20+91,8=20@@=0A=20(require=20= 'gud)=0A=20(require=20'json)=0A=20(require=20'bindat)=0A-(require=20= 'cl-lib)=0A+(eval-when-compile=20(require=20'cl-lib))=0A= +(eval-when-compile=20(require=20'pcase))=0A=20=0A=20(declare-function=20= speedbar-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-589,6=20= +590,20=20@@=20gdb-show-main=0A=20=20=20:group=20'gdb=0A=20=20=20= :version=20"22.1")=0A=20=0A+(defcustom=20gdb-window-layout-directory=20= user-emacs-directory=0A+=20=20"The=20default=20directory=20where=20= window=20configuration=20files=20are=20stored.=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=20= gdb-default-window-layout-file=20nil=0A+=20=20"If=20non-nil,=20gdb=20= loads=20this=20window=20layout=20file=20on=20startup.=0A+If=20not=20= absolute,=20GDB=20will=20look=20under=20`gdb-window-layout-directory'."=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=20= non-nil,=20print=20the=20messages=20sent/received=20from=20GDB/MI=20in=20= *Messages*.")=0A=20=0A@@=20-4459,6=20+4474,8=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[load-layout]=20'("Load=20window=20layout"=20.=20= gdb-load-window-layout))=0A+=20=20(define-key=20menu=20[save-layout]=20= '("Save=20window=20layout"=20.=20gdb-save-window-layout))=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.=20= gdb-display-threads-buffer))=0A=20=20=20(define-key=20menu=20[memory]=20= '("Memory"=20.=20gdb-display-memory-buffer))=0A@@=20-4574,41=20+4591,169=20= @@=20gdb-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-get-source-buffer=20()=0A+=20=20"Return=20a=20buffer=20= displaying=20source=20file=20or=20nil.=0A+=0A+The=20source=20file=20= would=20be=20the=20most=20relevant=20file=20or=20the=20main=20file."=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-layout-file=0A+=20=20=20=20=20=20= (gdb-load-window-layout=0A+=20=20=20=20=20=20=20(if=20= (file-name-absolute-p=20gdb-default-window-layout-file)=0A+=20=20=20=20=20= =20=20=20=20=20=20gdb-default-window-layout-file=0A+=20=20=20=20=20=20=20= =20=20(expand-file-name=20gdb-default-window-layout-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-layout-directory)))=0A+=20=20=20=20;;=20Create=20default=20= layout=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=0A+=20=20=20= =20=20=20=20win2=0A+=20=20=20=20=20=20=20(or=20(gdb-get-source-buffer)=0A= +=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)=20nil=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= +E.g.,=20locals=20buffer,=20registers=20buffer,=20but=20don't=20include=20= the=20main=0A+command=20buffer=20(the=20one=20in=20where=20you=20type=20= gdb=20commands)=20or=20source=0A+buffers."=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=20buffer=20type=20of=20BUFFER=20or=20nil.=0A+=0A+Buffer=20= type=20is=20like=20`gdb-registers-type',=20`gdb-stack-buffer'.=0A+This=20= symbol=20can=20be=20passed=20to=20`gdb-get-buffer-create'.=0A+=0A+Return=20= nil=20if=20BUFFER=20isn't=20a=20gdb=20function=20buffer."=0A+=20=20= (with-current-buffer=20buffer=0A+=20=20=20=20(cl-loop=20for=20rule=20in=20= gdb-buffer-rules=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20for=20= mode-name=20=3D=20(gdb-rules-buffer-mode=20rule)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20for=20type=20=3D=20(car=20rule)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20if=20(eq=20mode-name=20major-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-layout=20= (file)=0A+=20=20"Save=20current=20window=20layout=20(window=20= configuration)=20to=20FILE.=0A+=0A+You=20can=20later=20restore=20this=20= layout=20from=20that=20file=20by=0A+`gdb-load-window-layout'."=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=20= file:=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=20gdb-window-layout-directory=20default-directory))))=0A+=20=20= ;;=20We=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=20=20=20=20= window-config)=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=20win)=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=20nil=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=20arranged=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;;=20= configuration=20herself=20and=20saves=20it,=20windows=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=20= not=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=20dedication=20flag=20as=20= in=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=20nil=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=20= gdb-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=20pass=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=20= gdb=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=20buffer.=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)=20gdb-source-window)=20= 'source)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (with-selected-window-undedicated=0A+=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(set-window-prev-buffers=20(selected-window)=20= nil)=0A+=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=20t)))=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-layout=20(file)=0A+=20=20"Restore=20window=20layout=20= (window=20configuration)=20from=20FILE.=0A+=0A+FILE=20should=20be=20a=20= window=20layout=20file=20saved=20by=0A+`gdb-save-window-layout'."=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=20= from=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=20gdb-window-layout-directory=20default-directory))))=0A= +=20=20;;=20Basically,=20we=20restore=20window=20configuration=20and=20= go=20through=20each=0A+=20=20;;=20window=20and=20restore=20the=20= function=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=20= leak=20buffer.=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=20even=20we=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;;=20are=20reading=20the=20whole=20buffer.=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(if=20gdb-source-window=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= (window-buffer=20gdb-source-window)=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(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=20;;=20Do=20the=20= same=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=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=20= ;;=20buffer=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=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-selected-window-undedicated=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-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= -4627,6=20+4772,9=20@@=20gdb-many-windows=0A=20(defun=20= gdb-restore-windows=20()=0A=20=20=20"Restore=20the=20basic=20arrangement=20= of=20windows=20used=20by=20gdb.=0A=20This=20arrangement=20depends=20on=20= the=20value=20of=20option=20`gdb-many-windows'."=0A+=20=20;;=20This=20= function=20is=20used=20when=20the=20user=20messed=20up=20window=0A+=20=20= ;;=20configuration=20and=20want=20to=20"reset=20to=20default".=20=20The=20= function=20that=0A+=20=20;;=20sets=20up=20window=20configuration=20on=20= start=20up=20is=20`gdb-get-source-file'.=0A=20=20=20(interactive)=0A=20=20= =20(switch-to-buffer=20gud-comint-buffer)=20;Select=20the=20right=20= window=20and=20frame.=0A=20=20=20(delete-other-windows)=0A@@=20-4678,6=20= +4826,7=20@@=20gdb-reset=0A=20(defun=20gdb-get-source-file=20()=0A=20=20=20= "Find=20the=20source=20file=20where=20the=20program=20starts=20and=20= display=20it=20with=20related=0A=20buffers,=20if=20required."=0A+=20=20= ;;=20This=20function=20is=20called=20only=20once=20on=20startup.=0A=20=20= =20(goto-char=20(point-min))=0A=20=20=20(if=20(re-search-forward=20= gdb-source-file-regexp=20nil=20t)=0A=20=20=20=20=20=20=20(setq=20= gdb-main-file=20(read=20(match-string=201))))=0Adiff=20--git=20= a/lisp/window.el=20b/lisp/window.el=0Aindex=20433486385d..0f4f242212=20= 100644=0A---=20a/lisp/window.el=0A+++=20b/lisp/window.el=0A@@=20-278,6=20= +278,19=20@@=20with-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-selected-window-undedicated=20= (&rest=20body)=0A+=20=20"Run=20BODY=20in=20the=20selected=20window=20= temporarily=20undedicated."=0A+=20=20(let=20((window-dedicated-sym=20= (gensym)))=0A+=20=20=20=20`(let=20((,window-dedicated-sym=20= (window-dedicated-p)))=0A+=20=20=20=20=20=20=20(when=20= ,window-dedicated-sym=0A+=20=20=20=20=20=20=20=20=20= (set-window-dedicated-p=20nil=20nil))=0A+=20=20=20=20=20=20=20,@body=0A+=20= =20=20=20=20=20=20(when=20,window-dedicated-sym=0A+=20=20=20=20=20=20=20=20= =20;;=20`window-dedicated-p'=20returns=20the=20value=20set=20by=0A+=20=20= =20=20=20=20=20=20=20;;=20`set-window-dedicated-p',=20which=20= differentiates=0A+=20=20=20=20=20=20=20=20=20;;=20non-nil=20and=20t,=20= so=20we=20cannot=20simply=20set=20to=20t.=0A+=20=20=20=20=20=20=20=20=20= (set-window-dedicated-p=20nil=20,window-dedicated-sym)))))=0A+=0A=20;;=20= The=20following=20two=20functions=20are=20like=20`window-next-sibling'=20= and=0A=20;;=20`window-prev-sibling'=20but=20the=20WINDOW=20argument=20is=20= _not_=20optional=20(so=0A=20;;=20they=20don't=20substitute=20the=20= selected=20window=20for=20nil),=20and=20they=20return=0A--=20=0A2.25.0=0A= =0A= --Apple-Mail=_DAB05EEB-D33C-4D29-BA1E-A72E534C599F--