From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at, emacs-devel@gnu.org, monnier@iro.umontreal.ca,
john@yates-sheets.org, juri@linkov.net
Subject: Re: Extend gdb to filter registers
Date: Sat, 25 Jan 2020 17:34:13 -0500 [thread overview]
Message-ID: <6AC6E78C-69C2-400C-902E-CCB32E296887@gmail.com> (raw)
In-Reply-To: <83zhecoseo.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 3707 bytes --]
>
>> I don't understand this part: wasn't the original motivation to cause
>> gdb-mi to _always_ reuse the source window?
>>
>> You have the choice. If I want gdb to always reuse the window, I can set the number to 1.
>
> Yes, I think we should probably start at 1 and let users customize
> that if they want to.
Sure. So we are still using numbers (instead of symbols like `only-one-window` and `switch-between-two`, etc)?
>
>> My personal preference, and something I was always telling users who
>> expressed frustration with gdb-mi window handling, is to devote a
>> separate frame to gdb-mi windows. This avoids messing up the user's
>> windows on other frames. If enough people here agree with that,
>> perhaps we should move gdb-mi towards preferring such a modus
>> operandi?
>>
>> Are you referring to the complain that gdb messes up windows after it quits?
>
> No, the usual complaint is that gdb-mi messes up windows during the
> debugging session itself. E.g., if you had several source files
> displayed in carefully configured windows on a frame, starting
> "M-x gdb" will typically mess up your window configuration on that
> frame. Using a separate frame works around that.
>> That’s not hard to fix since we
>> have window-configurations now. I have a patch that makes gdb preserves window configuration that the user
>> had prior to starting gdb.
>
> That could be another way, but running a debugging session usually
> benefits from maximizing the frame. Will your patch undo that as well?
No, I simply save the window configuration at gdb start up by `window-state-get` and restores it when gdb quits. If gdb doesn’t maximize the frame, it shouldn’t un-maximize the frame after it quits either. If you want to make gdb maximize the frame by default, then gdb should un-maximize the frame after it quits. What I want to say is, who makes the change, who is responsible for it.
> >> I still haven’t had a clear idea on “how to open the new window” part. In the previous patch I simply used
> >> display-window-pop-window so the code works, but we should definitely come up with something else.
> >> Currently my naive idea is to use (display-buffer buffer gdb-display-source-buffer-action), where
> >> gdb-display-source-buffer-action can be customized by user. WDYT?
> >
> > Sounds OK, but I'd still like to hear martin's views on this.
>
> I think gdb could provide customizations via one or more customizable
> actions but always let users override them via their own buffer display
> customizations.
Do you mean user should be able to overwrite gdb-display-source-buffer-action as in (display-buffer gdb-display-source-buffer-action)? He is free to do so like any other (custom) variables. If you mean rules in `display-buffer-alist` should take precedence over gdb-display-source-buffer-action, I disagree. Because a source buffer in gdb setting is different from a normal buffer — it shouldn’t be surprising that source buffers display differently in gdb. Or, think of gdb as a special case, and special case normally take precedence over normal case.
As for John’s idea, un-splittable window property, I think it makes sense and would certainly be useful. But I suspect that the implementation is not as easy as that.
Below is the updates since last patch. Please apply this on top of the last patch. I figure this way you see the updates better. Now gud has the old behavior, `gdb-display-source-buffer` uses (display-buffer gdb-display-source-buffer-action), and I added two custom variable `gdb-max-source-window-count`(default to 1) and `gdb-display-source-buffer-action`.
Yuan
[-- Attachment #2: simplify-update1.patch --]
[-- Type: application/octet-stream, Size: 2922 bytes --]
From 0c54015a2264830ceb34f9458a4ebfbef92d7b70 Mon Sep 17 00:00:00 2001
From: Yuan Fu <casouri@gmail.com>
Date: Sat, 25 Jan 2020 17:27:32 -0500
Subject: [PATCH] Simplify update 1
---
lisp/progmodes/gdb-mi.el | 19 ++++++++++++++++---
lisp/progmodes/gud.el | 6 +++++-
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 27031e24f7..db1f544077 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -214,8 +214,6 @@ gdb-first-done-or-error
(defvar gdb-source-window-list nil
"List of windows used for displaying source files.
Sorted in most recently visited first order.")
-(defvar gdb-max-source-window-count 2
- "Maximum number of source windows to use.")
(defvar gdb-inferior-status nil)
(defvar gdb-continuation nil)
(defvar gdb-supports-non-stop nil)
@@ -593,6 +591,21 @@ gdb-show-main
:group 'gdb
:version "22.1")
+(defcustom gdb-display-source-buffer-action nil
+ "`display-buffer' action used when GDB displaying a source buffer."
+ :type 'list
+ :group 'gdb
+ :version "28.1")
+
+(defcustom gdb-max-source-window-count 1
+ "Maximum number of source windows to use.
+Until there are such number of source windows on screen, GDB
+tries to open a new window when visiting a new source file; if
+there are, GDB will start to reuse existing source windows."
+ :type 'number
+ :grou 'gdb
+ :version "28.1")
+
(defvar gdbmi-debug-mode nil
"When non-nil, print the messages sent/received from GDB/MI in *Messages*.")
@@ -2020,7 +2033,7 @@ gdb-display-source-buffer
(if (> gdb-max-source-window-count
(length gdb-source-window-list))
;; create new window, push to list, return it
- (car (push (display-buffer-pop-up-window buffer nil)
+ (car (push (display-buffer buffer gdb-display-source-buffer-action)
gdb-source-window-list))
;; reuse, we use the oldest window and put that to front
(let ((last-win (car (last gdb-source-window-list)))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index ccf9026417..8189394c60 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -2826,7 +2826,11 @@ gud-display-line
(buffer
(with-current-buffer gud-comint-buffer
(gud-find-file true-file)))
- (window (when buffer (gdb-display-source-buffer buffer)))
+ (window (when buffer (if (eq gud-minor-mode 'gdb-mi)
+ (gdb-display-source-buffer buffer)
+ ;; we don't change the old behavior for gud
+ (or (get-buffer-window buffer)
+ (display-buffer buffer '(nil (inhibit-same-window . t)))))))
(pos))
(when buffer
(with-current-buffer buffer
--
2.25.0
[-- Attachment #3: Type: text/plain, Size: 3 bytes --]
next prev parent reply other threads:[~2020-01-25 22:34 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 16:40 Extend gdb to filter registers Yuan Fu
2019-10-04 16:13 ` Fu Yuan
2019-10-04 19:32 ` Eli Zaretskii
2019-10-04 19:49 ` Stefan Monnier
2019-10-04 21:55 ` Yuan Fu
2019-10-05 3:15 ` Yuan Fu
2019-10-05 7:08 ` Eli Zaretskii
2019-10-05 13:15 ` Yuan Fu
2019-10-05 13:53 ` Eli Zaretskii
2019-10-05 17:51 ` Yuan Fu
2019-10-05 19:01 ` Eli Zaretskii
2019-10-06 4:24 ` Yuan Fu
2019-10-06 17:36 ` Eli Zaretskii
2019-10-08 2:23 ` Yuan Fu
2019-10-06 4:43 ` Michael Welsh Duggan
2019-10-07 15:50 ` Yuan Fu
2019-10-07 16:19 ` Michael Welsh Duggan
2019-10-08 0:19 ` Yuan Fu
2019-10-08 17:26 ` Stefan Monnier
2019-10-09 3:44 ` Yuan Fu
2019-10-09 3:51 ` Yuan Fu
2019-10-15 3:05 ` Yuan Fu
2019-10-15 9:48 ` martin rudalics
2019-10-17 3:14 ` Yuan Fu
2019-10-17 3:27 ` Yuan Fu
2019-10-17 8:26 ` martin rudalics
2019-10-15 18:10 ` Juri Linkov
2019-10-15 20:51 ` Stefan Monnier
2019-10-17 3:08 ` Yuan Fu
2019-10-17 8:19 ` Eli Zaretskii
2019-10-26 21:56 ` Yuan Fu
2019-10-27 7:47 ` martin rudalics
2019-10-27 17:38 ` Yuan Fu
2020-01-16 4:25 ` Yuan Fu
2020-01-16 14:51 ` Eli Zaretskii
2020-01-16 15:04 ` Yuan Fu
[not found] ` <CAO0xp5w8PwAiy=JNVmCK652rCs_06cMAO5_+1ppHwppQ2js4VQ@mail.gmail.com>
2020-01-17 23:31 ` Yuan Fu
2020-01-18 11:15 ` Eli Zaretskii
2020-01-18 13:32 ` Yuan Fu
2020-01-18 15:21 ` Eli Zaretskii
2020-01-18 15:41 ` Yuan Fu
2020-01-18 16:50 ` Eli Zaretskii
2020-01-18 16:20 ` John Yates
2020-01-18 16:53 ` Eli Zaretskii
2020-01-18 17:53 ` Yuan Fu
2020-01-18 17:56 ` Eli Zaretskii
2020-01-18 18:21 ` martin rudalics
2020-01-18 18:33 ` Eli Zaretskii
2020-01-18 18:36 ` Yuan Fu
2020-01-18 18:48 ` Eli Zaretskii
2020-01-18 20:10 ` Yuan Fu
2020-01-18 18:41 ` martin rudalics
2020-01-18 19:18 ` Eli Zaretskii
2020-01-18 21:43 ` martin rudalics
2020-01-19 15:40 ` Eli Zaretskii
2020-01-19 17:33 ` Yuan Fu
2020-01-19 17:42 ` Eli Zaretskii
2020-01-19 17:57 ` Yuan Fu
2020-01-19 18:43 ` Eli Zaretskii
2020-01-19 19:35 ` Yuan Fu
2020-01-19 20:07 ` Eli Zaretskii
2020-01-20 1:22 ` Yuan Fu
2020-01-20 18:03 ` Eli Zaretskii
2020-01-22 1:50 ` Yuan Fu
2020-01-24 7:16 ` Eli Zaretskii
2020-01-24 20:12 ` Yuan Fu
2020-01-24 22:37 ` John Yates
2020-01-25 7:45 ` Eli Zaretskii
2020-01-25 14:33 ` John Yates
2020-01-25 17:10 ` Eli Zaretskii
2020-01-25 8:43 ` martin rudalics
2020-01-25 14:56 ` John Yates
2020-01-25 17:14 ` martin rudalics
2020-01-25 20:17 ` John Yates
2020-01-26 8:41 ` martin rudalics
2020-01-26 4:18 ` Richard Stallman
2020-01-26 5:09 ` Drew Adams
2020-01-26 5:31 ` Yuan Fu
2020-01-26 17:12 ` Eli Zaretskii
2020-01-25 8:24 ` Eli Zaretskii
2020-01-25 8:58 ` martin rudalics
2020-01-25 10:25 ` Eli Zaretskii
2020-01-25 10:30 ` Eli Zaretskii
2020-01-25 22:34 ` Yuan Fu [this message]
2020-01-26 8:42 ` martin rudalics
2020-01-26 16:12 ` Yuan Fu
2020-01-26 16:57 ` martin rudalics
2020-01-27 15:56 ` Yuan Fu
2020-01-27 19:18 ` martin rudalics
2020-01-27 19:53 ` Yuan Fu
2020-01-28 9:49 ` martin rudalics
2020-01-28 20:01 ` Yuan Fu
2020-01-28 20:33 ` John Yates
2020-01-31 13:58 ` Eli Zaretskii
2020-01-31 15:25 ` Yuan Fu
2020-01-31 15:35 ` Eli Zaretskii
2020-01-25 8:43 ` martin rudalics
2020-01-25 10:21 ` Eli Zaretskii
2020-01-25 12:11 ` martin rudalics
2020-01-25 13:35 ` Eli Zaretskii
2020-01-25 8:42 ` martin rudalics
2020-01-19 18:30 ` martin rudalics
2020-01-19 18:47 ` Eli Zaretskii
2020-01-19 18:05 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6AC6E78C-69C2-400C-902E-CCB32E296887@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=john@yates-sheets.org \
--cc=juri@linkov.net \
--cc=monnier@iro.umontreal.ca \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).