emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toolbar problems with GDB mode.


From: Nick Roberts
Subject: Re: Toolbar problems with GDB mode.
Date: Tue, 7 Jan 2003 23:21:05 +0000

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]