337
(defvar in-blame-filter nil)
338
339
(defun git-blame-filter (proc str)
340
- (save-excursion
341
- (set-buffer (process-buffer proc))
342
- (goto-char (process-mark proc))
343
- (insert-before-markers str)
344
- (goto-char 0)
345
- (unless in-blame-filter
346
- (let ((more t)
347
- (in-blame-filter t))
348
- (while more
349
- (setq more (git-blame-parse)))))))
340
+ (with-current-buffer (process-buffer proc)
341
+ (save-excursion
342
+ (goto-char (process-mark proc))
343
+ (insert-before-markers str)
344
+ (goto-char 0)
345
+ (unless in-blame-filter
346
+ (let ((more t)
347
+ (in-blame-filter t))
348
+ (while more
349
+ (setq more (git-blame-parse))))))))
350
351
(defun git-blame-parse ()
352
(cond ((looking-at "\\([0-9a-f]\\{40\\}\\) \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\)\n")
385
info))))
386
387
(defun git-blame-create-overlay (info start-line num-lines)
388
- (save-excursion
389
- (set-buffer git-blame-file)
390
- (let ((inhibit-point-motion-hooks t)
391
- (inhibit-modification-hooks t))
392
- (goto-char (point-min))
393
- (forward-line (1- start-line))
394
- (let* ((start (point))
395
- (end (progn (forward-line num-lines) (point)))
396
- (ovl (make-overlay start end))
397
- (hash (car info))
398
- (spec `((?h . ,(substring hash 0 6))
399
- (?H . ,hash)
400
- (?a . ,(git-blame-get-info info 'author))
401
- (?A . ,(git-blame-get-info info 'author-mail))
402
- (?c . ,(git-blame-get-info info 'committer))
403
- (?C . ,(git-blame-get-info info 'committer-mail))
404
- (?s . ,(git-blame-get-info info 'summary)))))
405
- (push ovl git-blame-overlays)
406
- (overlay-put ovl 'git-blame info)
407
- (overlay-put ovl 'help-echo
408
- (format-spec git-blame-mouseover-format spec))
409
- (if git-blame-use-colors
410
- (overlay-put ovl 'face (list :background
411
- (cdr (assq 'color (cdr info))))))
412
- (overlay-put ovl 'line-prefix
413
- (propertize (format-spec git-blame-prefix-format spec)
414
- 'face 'git-blame-prefix-face))))))
388
+ (with-current-buffer git-blame-file
389
+ (save-excursion
390
+ (let ((inhibit-point-motion-hooks t)
391
+ (inhibit-modification-hooks t))
392
+ (goto-char (point-min))
393
+ (forward-line (1- start-line))
394
+ (let* ((start (point))
395
+ (end (progn (forward-line num-lines) (point)))
396
+ (ovl (make-overlay start end))
397
+ (hash (car info))
398
+ (spec `((?h . ,(substring hash 0 6))
399
+ (?H . ,hash)
400
+ (?a . ,(git-blame-get-info info 'author))
401
+ (?A . ,(git-blame-get-info info 'author-mail))
402
+ (?c . ,(git-blame-get-info info 'committer))
403
+ (?C . ,(git-blame-get-info info 'committer-mail))
404
+ (?s . ,(git-blame-get-info info 'summary)))))
405
+ (push ovl git-blame-overlays)
406
+ (overlay-put ovl 'git-blame info)
407
+ (overlay-put ovl 'help-echo
408
+ (format-spec git-blame-mouseover-format spec))
409
+ (if git-blame-use-colors
410
+ (overlay-put ovl 'face (list :background
411
+ (cdr (assq 'color (cdr info))))))
412
+ (overlay-put ovl 'line-prefix
413
+ (propertize (format-spec git-blame-prefix-format spec)
414
+ 'face 'git-blame-prefix-face)))))))
415
416
(defun git-blame-add-info (info key value)
417
(nconc info (list (cons (intern key) value))))