comparison lisp/gud.el @ 49146:8e748161e8cf

(gud-kill-buffer-hook): Save gud-minor-mode type. (gud-reset): New function. Reset environment at end of debugging. (gud-sentinel): Call gud-reset or gdb-reset.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 11 Jan 2003 16:46:35 +0000
parents aa7d3d1a21a3
children 7ae18fc8cd2f
comparison
equal deleted inserted replaced
49145:c9b0a36c96b5 49146:8e748161e8cf
2425 (defun gud-sentinel (proc msg) 2425 (defun gud-sentinel (proc msg)
2426 (cond ((null (buffer-name (process-buffer proc))) 2426 (cond ((null (buffer-name (process-buffer proc)))
2427 ;; buffer killed 2427 ;; buffer killed
2428 ;; Stop displaying an arrow in a source file. 2428 ;; Stop displaying an arrow in a source file.
2429 (setq overlay-arrow-position nil) 2429 (setq overlay-arrow-position nil)
2430 (set-process-buffer proc nil)) 2430 (set-process-buffer proc nil)
2431 (if (eq gud-minor-mode-type 'gdba)
2432 (gdb-reset)
2433 (gud-reset)))
2431 ((memq (process-status proc) '(signal exit)) 2434 ((memq (process-status proc) '(signal exit))
2432 ;; Stop displaying an arrow in a source file. 2435 ;; Stop displaying an arrow in a source file.
2433 (setq overlay-arrow-position nil) 2436 (setq overlay-arrow-position nil)
2437 (with-current-buffer gud-comint-buffer
2438 (if (eq gud-minor-mode 'gdba)
2439 (gdb-reset)
2440 (gud-reset)))
2434 (let* ((obuf (current-buffer))) 2441 (let* ((obuf (current-buffer)))
2435 ;; save-excursion isn't the right thing if 2442 ;; save-excursion isn't the right thing if
2436 ;; process-buffer is current-buffer 2443 ;; process-buffer is current-buffer
2437 (unwind-protect 2444 (unwind-protect
2438 (progn 2445 (progn
2453 ;; will stay around until M-x list-processes. 2460 ;; will stay around until M-x list-processes.
2454 (delete-process proc)) 2461 (delete-process proc))
2455 ;; Restore old buffer, but don't restore old point 2462 ;; Restore old buffer, but don't restore old point
2456 ;; if obuf is the gud buffer. 2463 ;; if obuf is the gud buffer.
2457 (set-buffer obuf)))))) 2464 (set-buffer obuf))))))
2465
2466 (defvar gud-minor-mode-type nil)
2467
2468 (defun gud-kill-buffer-hook ()
2469 (if gud-minor-mode
2470 (setq gud-minor-mode-type gud-minor-mode)))
2471
2472 (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook)
2473
2474 (defun gud-reset ()
2475 (dolist (buffer (buffer-list))
2476 (if (not (eq buffer gud-comint-buffer))
2477 (save-excursion
2478 (set-buffer buffer)
2479 (when gud-minor-mode
2480 (setq gud-minor-mode nil)
2481 (kill-local-variable 'tool-bar-map))))))
2458 2482
2459 (defun gud-display-frame () 2483 (defun gud-display-frame ()
2460 "Find and obey the last filename-and-line marker from the debugger. 2484 "Find and obey the last filename-and-line marker from the debugger.
2461 Obeying it means displaying in another window the specified file and line." 2485 Obeying it means displaying in another window the specified file and line."
2462 (interactive) 2486 (interactive)