From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: Toolbar problems with GDB mode. Date: Tue, 7 Jan 2003 23:21:05 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <15899.24801.160084.755641@nick.uklinux.net> References: <15894.10751.990342.816630@nick.uklinux.net> <200301041432.h04EWjeA032078@stubby.bodenonline.com> <15895.15327.116822.876751@nick.uklinux.net> <3E19E198.7010107@ihs.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1042005560 30837 80.91.224.249 (8 Jan 2003 05:59:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2003 05:59:20 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18W9FF-000819-00 for ; Wed, 08 Jan 2003 06:59:17 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18W9K8-0000Gs-00 for ; Wed, 08 Jan 2003 07:04:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18W6oi-00089Z-02 for emacs-devel@quimby.gnus.org; Tue, 07 Jan 2003 22:23:44 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18W6oR-00088P-00 for emacs-devel@gnu.org; Tue, 07 Jan 2003 22:23:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18W6K2-0001Ev-00 for emacs-devel@gnu.org; Tue, 07 Jan 2003 21:52:33 -0500 Original-Received: from bts-0901.dialup.zetnet.co.uk ([194.247.51.133] helo=nick.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18W34W-0000LU-00 for emacs-devel@gnu.org; Tue, 07 Jan 2003 18:23:49 -0500 Original-Received: by nick.uklinux.net (Postfix, from userid 501) id E0E4C76037; Tue, 7 Jan 2003 23:21:06 +0000 (GMT) Original-To: Kevin Rodgers In-Reply-To: <3E19E198.7010107@ihs.com> X-Mailer: VM 6.97 under Emacs 21.3.50.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10564 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10564 Kevin Rodgers writes: > > Please don't simply kill the buffer. Always type gdb-quit before starting > > a new session. I'm writing documentation to say things like that and I > > will try to make it more robust with time. > Could you install a local kill-buffer-hook to handle that for users like Jan? Yes. I think this works best. I was trying to put it in gud-sentinel which is called every time the process state changes. However, this is after the GUD buffer is killed which makes it difficult to distinguish between gdb and gdba. kill-buffer-hook won't work if the user types quit in the GUD buffer but this probably doesn't matter as quit doesn't make much sense here and just leaves a dead buffer lying around. How about: (defun gud-kill-buffer-hook () (if (eq (current-buffer) gud-comint-buffer) (cond ((eq gud-minor-mode 'gdba) (gdb-delete-frames '()) (dolist (buffer (buffer-list)) (if (not (eq buffer gud-comint-buffer)) (save-excursion (set-buffer buffer) (if (eq gud-minor-mode 'gdba) (if (string-match "^\*.+*$" (buffer-name)) (kill-buffer nil) (if (display-graphic-p) (remove-images (point-min) (point-max)) (remove-strings (point-min) (point-max))) (setq left-margin-width 0) (setq gud-minor-mode nil) (kill-local-variable 'tool-bar-map) (setq gud-running nil) (if (get-buffer-window (current-buffer)) (set-window-margins (get-buffer-window (current-buffer)) left-margin-width right-margin-width)))))))) (t (dolist (buffer (buffer-list)) (if (not (eq buffer gud-comint-buffer)) (save-excursion (set-buffer buffer) (when gud-minor-mode (setq gud-minor-mode nil) (kill-local-variable 'tool-bar-map))))))))) (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook)