- (let* ((display-buf (current-buffer))
- (blame-buf (get-buffer-create
- (concat " git blame for " (buffer-name))))
- (proc (start-process "git-blame" blame-buf
- "git" "blame" "--incremental"
- (file-name-nondirectory buffer-file-name))))
- (mapcar 'delete-overlay git-blame-overlays)
- (setq git-blame-overlays nil)
- (setq git-blame-cache (make-hash-table :test 'equal))
- (with-current-buffer blame-buf
- (erase-buffer)
- (make-local-variable 'git-blame-file)
- (make-local-variable 'git-blame-current)
- (setq git-blame-file display-buf)
- (setq git-blame-current nil))
- (set-process-filter proc 'git-blame-filter)
- (set-process-sentinel proc 'git-blame-sentinel)))
+ (if git-blame-proc
+ ;; Should maybe queue up a new run here
+ (message "Already running git blame")
+ (let ((display-buf (current-buffer))
+ (blame-buf (get-buffer-create
+ (concat " git blame for " (buffer-name)))))
+ (setq git-blame-proc
+ (start-process "git-blame" blame-buf
+ "git" "blame"
+ "--incremental" "--contents" "-"
+ (file-name-nondirectory buffer-file-name)))
+ (with-current-buffer blame-buf
+ (erase-buffer)
+ (make-local-variable 'git-blame-file)
+ (make-local-variable 'git-blame-current)
+ (setq git-blame-file display-buf)
+ (setq git-blame-current nil))
+ (set-process-filter git-blame-proc 'git-blame-filter)
+ (set-process-sentinel git-blame-proc 'git-blame-sentinel)
+ (process-send-region git-blame-proc (point-min) (point-max))
+ (process-send-eof git-blame-proc))))