Function: vc--process-sentinel

vc--process-sentinel is a byte-compiled function defined in vc-dispatcher.el.gz.

Signature

(vc--process-sentinel P CODE &optional SUCCESS)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dispatcher.el.gz
(defvar vc-sentinel-movepoint)          ;Dynamically scoped.

(defun vc--process-sentinel (p code &optional success)
  (let ((buf (process-buffer p)))
    ;; Impatient users sometime kill "slow" buffers; check liveness
    ;; to avoid "error in process sentinel: Selecting deleted buffer".
    (when (buffer-live-p buf)
      (with-current-buffer buf
        (setq mode-line-process
              (let ((status (process-status p)))
                ;; Leave mode-line uncluttered, normally.
                (unless (eq 'exit status)
                  (format " (%s)" status))))
        (let (vc-sentinel-movepoint
              (m (process-mark p)))
          ;; Normally, we want async code such as sentinels to not move point.
          (save-excursion
            (goto-char m)
            ;; Each sentinel may move point and the next one should be run
            ;; at that new point.  We could get the same result by having
            ;; each sentinel read&set process-mark, but since `cmd' needs
            ;; to work both for async and sync processes, this would be
            ;; difficult to achieve.
            (vc-exec-after code success)
            (move-marker m (point)))
          ;; But sometimes the sentinels really want to move point.
          (when vc-sentinel-movepoint
	    (let ((win (get-buffer-window (current-buffer) 0)))
	      (if (not win)
		  (goto-char vc-sentinel-movepoint)
		(with-selected-window win
		  (goto-char vc-sentinel-movepoint))))))))))