comparison lisp/vc.el @ 71791:6d32f7f6fd3a NewVC-fileset-BASE

* vc.el (vc-exec-after): Don't delete process manually. (vc-print-log): Run log-view-mode in process sentinel inside inhibit-read-only. Don't shrink window due to timing issues.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 11 Jul 2006 18:39:32 +0000
parents 4257c62a5b2a
children 59e895845146 b19aaf4ab0ee 8a8e69664178
comparison
equal deleted inserted replaced
71790:8a30c071b5fb 71791:6d32f7f6fd3a
932 If the current buffer has no process, just evaluate CODE. 932 If the current buffer has no process, just evaluate CODE.
933 Else, add CODE to the process' sentinel." 933 Else, add CODE to the process' sentinel."
934 (let ((proc (get-buffer-process (current-buffer)))) 934 (let ((proc (get-buffer-process (current-buffer))))
935 (cond 935 (cond
936 ;; If there's no background process, just execute the code. 936 ;; If there's no background process, just execute the code.
937 ((null proc) (eval code)) 937 ;; We used to explicitly call delete-process on exited processes,
938 ;; If the background process has exited, reap it and try again 938 ;; but this led to timing problems causing process output to be
939 ((eq (process-status proc) 'exit) 939 ;; lost. Terminated processes get deleted automatically
940 (delete-process proc) 940 ;; anyway. -- cyd
941 (vc-exec-after code)) 941 ((or (null proc) (eq (process-status proc) 'exit))
942 (eval code))
942 ;; If a process is running, add CODE to the sentinel 943 ;; If a process is running, add CODE to the sentinel
943 ((eq (process-status proc) 'run) 944 ((eq (process-status proc) 'run)
944 (let ((sentinel (process-sentinel proc))) 945 (let ((sentinel (process-sentinel proc)))
945 (set-process-sentinel proc 946 (set-process-sentinel proc
946 `(lambda (p s) 947 `(lambda (p s)
2444 (signal (car err) (cdr err)) 2445 (signal (car err) (cdr err))
2445 ;; for backward compatibility 2446 ;; for backward compatibility
2446 (vc-call print-log file) 2447 (vc-call print-log file)
2447 (set-buffer "*vc*")))) 2448 (set-buffer "*vc*"))))
2448 (pop-to-buffer (current-buffer)) 2449 (pop-to-buffer (current-buffer))
2449 (log-view-mode)
2450 (vc-exec-after 2450 (vc-exec-after
2451 `(let ((inhibit-read-only t)) 2451 `(let ((inhibit-read-only t))
2452 (log-view-mode)
2452 (goto-char (point-max)) (forward-line -1) 2453 (goto-char (point-max)) (forward-line -1)
2453 (while (looking-at "=*\n") 2454 (while (looking-at "=*\n")
2454 (delete-char (- (match-end 0) (match-beginning 0))) 2455 (delete-char (- (match-end 0) (match-beginning 0)))
2455 (forward-line -1)) 2456 (forward-line -1))
2456 (goto-char (point-min)) 2457 (goto-char (point-min))
2457 (if (looking-at "[\b\t\n\v\f\r ]+") 2458 (if (looking-at "[\b\t\n\v\f\r ]+")
2458 (delete-char (- (match-end 0) (match-beginning 0)))) 2459 (delete-char (- (match-end 0) (match-beginning 0))))
2459 (shrink-window-if-larger-than-buffer) 2460 ;; (shrink-window-if-larger-than-buffer)
2460 ;; move point to the log entry for the current version 2461 ;; move point to the log entry for the current version
2461 (vc-call-backend ',(vc-backend file) 2462 (vc-call-backend ',(vc-backend file)
2462 'show-log-entry 2463 'show-log-entry
2463 ',focus-rev) 2464 ',focus-rev)
2464 (set-buffer-modified-p nil))))) 2465 (set-buffer-modified-p nil)))))