comparison lisp/vc.el @ 71228:4d648a3d282d

(vc-process-filter): Inhibit undo info collection around call to insert. (vc-setup-buffer): Likewise for call to erase-buffer. (vc-do-command): Likewise for call to process-file.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Mon, 05 Jun 2006 15:42:55 +0000
parents 19ab508f832f
children b0324f716b87 46b1096093f5 a8190f7e546e
comparison
equal deleted inserted replaced
71227:33251672fc28 71228:4d648a3d282d
892 (if (not (vc-backend buffer-file-name)) 892 (if (not (vc-backend buffer-file-name))
893 (error "File %s is not under version control" buffer-file-name))))) 893 (error "File %s is not under version control" buffer-file-name)))))
894 894
895 (defun vc-process-filter (p s) 895 (defun vc-process-filter (p s)
896 "An alternative output filter for async process P. 896 "An alternative output filter for async process P.
897 The only difference with the default filter is to insert S after markers." 897 One difference with the default filter is that this inserts S after markers.
898 Another is that undo information is not kept."
898 (with-current-buffer (process-buffer p) 899 (with-current-buffer (process-buffer p)
899 (save-excursion 900 (save-excursion
900 (let ((inhibit-read-only t)) 901 (let ((buffer-undo-list t)
902 (inhibit-read-only t))
901 (goto-char (process-mark p)) 903 (goto-char (process-mark p))
902 (insert s) 904 (insert s)
903 (set-marker (process-mark p) (point)))))) 905 (set-marker (process-mark p) (point))))))
904 906
905 (defun vc-setup-buffer (&optional buf) 907 (defun vc-setup-buffer (&optional buf)
912 (kill-all-local-variables) 914 (kill-all-local-variables)
913 (set (make-local-variable 'vc-parent-buffer) camefrom) 915 (set (make-local-variable 'vc-parent-buffer) camefrom)
914 (set (make-local-variable 'vc-parent-buffer-name) 916 (set (make-local-variable 'vc-parent-buffer-name)
915 (concat " from " (buffer-name camefrom))) 917 (concat " from " (buffer-name camefrom)))
916 (setq default-directory olddir) 918 (setq default-directory olddir)
917 (let ((inhibit-read-only t)) 919 (let ((buffer-undo-list t)
920 (inhibit-read-only t))
918 (erase-buffer)))) 921 (erase-buffer))))
919 922
920 (defun vc-exec-after (code) 923 (defun vc-exec-after (code)
921 "Eval CODE when the current buffer's process is done. 924 "Eval CODE when the current buffer's process is done.
922 If the current buffer has no process, just evaluate CODE. 925 If the current buffer has no process, just evaluate CODE.
1001 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p))) 1004 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p)))
1002 (set-process-filter proc 'vc-process-filter) 1005 (set-process-filter proc 'vc-process-filter)
1003 (vc-exec-after 1006 (vc-exec-after
1004 `(unless (active-minibuffer-window) 1007 `(unless (active-minibuffer-window)
1005 (message "Running %s in the background... done" ',command)))) 1008 (message "Running %s in the background... done" ',command))))
1006 (setq status (apply 'process-file command nil t nil squeezed)) 1009 (let ((buffer-undo-list t))
1010 (setq status (apply 'process-file command nil t nil squeezed)))
1007 (when (and (not (eq t okstatus)) 1011 (when (and (not (eq t okstatus))
1008 (or (not (integerp status)) 1012 (or (not (integerp status))
1009 (and okstatus (< okstatus status)))) 1013 (and okstatus (< okstatus status))))
1010 (pop-to-buffer (current-buffer)) 1014 (pop-to-buffer (current-buffer))
1011 (goto-char (point-min)) 1015 (goto-char (point-min))