From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
Subject: Re: gdbui hang
Date: 11 May 2004 19:23:00 -0400 [thread overview]
Message-ID: <jwvsme6shwl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <16545.22265.561216.75019@nick.uklinux.net>
>> In general I think the add-hook should not be global but only apply to the
>> *gud* buffer.
> kill-buffer-hook *is* a global variable, though. gud-kill-buffer-hook does
> only apply to the *gud* buffer though the condition (eq (current-buffer)
> gud-comint-buffer). What's there to make local?
Se the `local' arg of ad-hook.
>> But I must say that I don't understand at all what the
>> current gud-kill-buffer-hook is doing:
>>
>> % grep -nH gud-minor-mode-type *.el
>> gud.el:2504:(defvar gud-minor-mode-type nil)
>> gud.el:2512: (if (eq gud-minor-mode-type 'gdba)
>> gud.el:2549: (setq gud-minor-mode-type gud-minor-mode)))
>>
>> It's a variable used in the process sentinel but only set when
>> a gud-minor-mode buffer is killed. Sounds pretty odd, yet there's no
>> comment explaniing what going on. Sounds like a bug (or some left over
>> code).
> I wrote that code, a while back. Here's my logic:
> gud-sentinel needs to do different things depending on whether gdb is run
> with "-fullname" (gud-minor-mode = 'gdb) or "-annotate=3" or
> (gud-minor-mode = 'gdba). gud-sentinel is executed after the buffer is
> killed and so can't deduce which case it is dealing with. However,
> gud-kill-buffer-hook is run before the buffer is killed, so it is used to
> store gud-minor-mode in the variable gud-minor-mode-type.
Ah I see. [ Reminds me that I'd like to add property lists to processes. ]
But in this particular case, I guess the best approach is to merge
gdb-reset into gud-reset so the sentinel doesn't have to care about the
difference between various gud-minor-mode.
BTW: the regexp "^\*.+*$" in gdb-reset should probably be "\\`\\*.+\\*\\'"
[ or even thrown away and replaced with something like a buffer-local variable
`gud-auxiliary-buffer' which would be set to non-nil (better yet: to the
main *gud* buffer) in those *foo* buffers. ]
> (defun gud-kill-buffer-hook ()
> (when (eq (current-buffer) gud-comint-buffer)
> (setq gud-minor-mode-type gud-minor-mode)
> (condition-case nil
> (kill-process (get-buffer-process gud-comint-buffer))
> (error nil))))
Sure. Except I'd add the hook buffer-locally so you don't need to check
(eq (current-buffer) gud-comint-buffer).
Stefan
next prev parent reply other threads:[~2004-05-11 23:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 4:43 gdbui hang Miles Bader
2004-05-10 6:22 ` Kim F. Storm
2004-05-10 17:30 ` Nick Roberts
2004-05-10 18:16 ` Stefan Monnier
2004-05-10 18:42 ` Nick Roberts
2004-05-11 12:23 ` Richard Stallman
2004-05-11 12:49 ` Miles Bader
2004-05-11 20:25 ` Nick Roberts
2004-05-11 21:08 ` Miles Bader
2004-05-11 21:27 ` Nick Roberts
2004-05-11 21:40 ` Stefan Monnier
2004-05-10 17:41 ` Nick Roberts
2004-05-10 19:09 ` Stefan Monnier
2004-05-11 21:07 ` Nick Roberts
2004-05-11 21:37 ` Stefan Monnier
2004-05-11 22:43 ` Nick Roberts
2004-05-11 23:23 ` Stefan Monnier [this message]
2004-05-12 12:40 ` Kim F. Storm
2004-05-12 14:59 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvsme6shwl.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=miles@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.