   (git-blame-cleanup)
   (git-blame-run))
 
-(defun git-blame-run ()
+(defun git-blame-run (&optional startline endline)
   (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)))))
+                      (concat " git blame for " (buffer-name))))
+          (args '("--incremental" "--contents" "-")))
+      (if startline
+          (setq args (append args
+                             (list "-L" (format "%d,%d" startline endline)))))
+      (setq args (append args
+                         (list (file-name-nondirectory buffer-file-name))))
       (setq git-blame-proc
-            (start-process "git-blame" blame-buf
-                           "git" "blame"
-                           "--incremental" "--contents" "-"
-                           (file-name-nondirectory buffer-file-name)))
+            (apply 'start-process
+                   "git-blame" blame-buf
+                   "git" "blame"
+                   args))
       (with-current-buffer blame-buf
         (erase-buffer)
         (make-local-variable 'git-blame-file)

    (setq git-blame-overlays nil)
    (remove-git-blame-text-properties (point-min) (point-max)))

(defun git-blame-sentinel (proc status)
  (with-current-buffer (process-buffer proc)
    (with-current-buffer git-blame-file
      (setq git-blame-proc nil)))
  ;;(kill-buffer (process-buffer proc))
  ;;(message "git blame finished")
  )

(defvar git-blame-cache nil
  "A cache of git-blame information for the current buffer")
(make-variable-buffer-local 'git-blame-cache)

(defvar git-blame-idle-timer nil
  "An idle timer that updates the blame")
(make-variable-buffer-local 'git-blame-cache)

(defvar git-blame-update-queue nil
  "A queue of update requests")
(make-variable-buffer-local 'git-blame-update-queue)

(defvar git-blame-mode nil)
(make-variable-buffer-local 'git-blame-mode)
