   ;; Right now the line guessing is terrible.
   (interactive)
   (let ((source-file (diffscuss-get-source-file "new"))
-        (line-num (diffscuss-calibrate-source-line)))
+        (line-num (diffscuss-calibrate-source-line "new")))
     (if (find-file-noselect source-file)
         (if (pop-to-buffer (get-file-buffer source-file))
             (goto-line line-num))

  (or (diffscuss-get-source-file first-choice)
      (diffscuss-get-source-file second-choice)))

(defun diffscuss-is-range-line ()
  "Non nil if line begins with @@."
  (save-excursion
    (beginning-of-line)
    (looking-at "^@@")))

(defun diffscuss-count-orig-source ()
  "Non nil if current line is part of the original source."
  (save-excursion
    (beginning-of-line)
    (looking-at "^[ -]")))

(defun diffscuss-calibrate-source-line ()
  "Deduce what line in the original source file the point is on."
  (save-excursion
    (let ((source-lines 1))
      (while (and (not (diffscuss-is-range-line))
                  (zerop (forward-line -1)))
        (if (diffscuss-count-orig-source)
            (setq source-lines (+ 1 source-lines))))
      (if (diffscuss-is-range-line)
          (+ source-lines (diffscuss-parse-orig-line))
        nil))))

(defun diffscuss-parse-orig-line ()
  "Parse the original line out of a range header."
  (save-excursion
    (beginning-of-line)
    (looking-at "^@@ -\\([[:digit:]]+\\)")
    (string-to-number (buffer-substring (match-beginning 1) (match-end 1)))))

(defun diffscuss-goto-local-source ()
  "Attempt to jump to the appropriate source."

  "Show the old version of the source from git, and jump to the right line."
  (interactive)
  (let ((source-file (diffscuss-get-any-source-file "old" "new"))
        (line-num (diffscuss-calibrate-source-line "old"))
        (rev (diffscuss-get-old-rev)))
    (diffscuss-show-source-rev source-file rev line-num "old")))

