Function: gud-sentinel

gud-sentinel is a byte-compiled function defined in gud.el.gz.

Signature

(gud-sentinel PROC MSG)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gud.el.gz
(defun gud-sentinel (proc msg)
  (cond ((null (buffer-name (process-buffer proc)))
	 ;; buffer killed
	 ;; Stop displaying an arrow and highlight overlay in a source file.
	 (gud-hide-current-line-indicator t)
	 (set-process-buffer proc nil)
	 (if (and (boundp 'speedbar-initial-expansion-list-name)
		  (string-equal speedbar-initial-expansion-list-name "GUD"))
	     (speedbar-change-initial-expansion-list
	      speedbar-previously-used-expansion-list-name))
	 (if (eq gud-minor-mode-type 'gdbmi)
	     (gdb-reset)
	   (gud-reset)))
	((memq (process-status proc) '(signal exit))

         (gud-hide-current-line-indicator t)

	 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
		   'gdbmi)
	     (gdb-reset)
	   (gud-reset))
	 (let* ((obuf (current-buffer)))
	   ;; save-excursion isn't the right thing if
	   ;;  process-buffer is current-buffer
	   (unwind-protect
	       (progn
		 ;; Write something in the GUD buffer and hack its mode line,
		 (set-buffer (process-buffer proc))
		 ;; Fix the mode line.
		 (setq mode-line-process
		       (concat ":"
			       (symbol-name (process-status proc))))
		 (force-mode-line-update)
		 (if (eobp)
		     (insert ?\n mode-name " " msg)
		   (save-excursion
		     (goto-char (point-max))
		     (insert ?\n mode-name " " msg)))
		 ;; If buffer and mode line will show that the process
		 ;; is dead, we can delete it now.  Otherwise it
		 ;; will stay around until M-x list-processes.
		 (delete-process proc))
	     ;; Restore old buffer, but don't restore old point
	     ;; if obuf is the gud buffer.
	     (set-buffer obuf))))))