 ;; Where to find git, by default assume it's whatever version is in
 ;; the path.
 (defvar diffscuss-git-exe "git")
-
-;; Where to find the python installation of diffscuss (where
-;; find-local-source.py is for example)
-(defvar diffscuss-dir nil)
-
-;; Where to find the version of python to use.  Minimum is 2.6.  (If
-;; you're on a mac, you may need to set this, as some macs seems to
-;; have 2.4 as the default version).
-(defvar diffscuss-python-exe "/usr/bin/python")
 
 ;; The top-level diffscuss command to run.  If you haven't installed
 ;; diffscuss somewhere in your path, you can override this to provide

      (looking-at line-pattern)
      (string-to-number (buffer-substring (match-beginning group-num) (match-end group-num))))))

(defun diffscuss-check-python ()
  (save-excursion
    (with-temp-buffer
      (call-process diffscuss-python-exe
                    nil
                    t
                    nil
                    "-V")
      (beginning-of-buffer)
      (if (not (looking-at "Python \\([[:digit:]]+\\)\\.\\([[:digit:]]+\\)"))
          (error "Python exe %s did not return version when run with -V" diffscuss-python-exe))
      (if (or (< (string-to-number (buffer-substring (match-beginning 1) (match-end 1)))
                 2)
              (< (string-to-number (buffer-substring (match-beginning 2) (match-end 2)))
                 6))
          (error "Python version too early, require 2.6+, found: %s"
                 (trim-string (buffer-string)))))))

(defun diffscuss-goto-local-source ()
  "Attempt to jump to the appropriate source."
  (interactive)
  (diffscuss-check-python)
  (if (not diffscuss-dir)
      (message "Must set diffscuss-dir before you can jump to local source" "")
    (progn
      (let ((outbuf-name (generate-new-buffer-name "diffscuss-local-source")))
        (if (/= 0 (call-process-region (point-min)
                                       (point-max)
                                       diffscuss-exe
                                       nil
                                       outbuf-name
                                       nil
                                       "find-local"
                                       (number-to-string (line-number-at-pos))))
            (with-current-buffer outbuf-name
              (message "%s" (buffer-string))
              (message "Could not find local source"))
          (progn
            (let ((to-find-fname nil)
                  (to-find-line nil))
              (with-current-buffer outbuf-name
                (setq to-find-fname (mapconcat
                                     'identity
                                     (butlast (split-string (buffer-string) " ") 1) " "))
                (setq to-find-line (car (last (split-string (buffer-string) " ") 1))))
              (pop-to-buffer (find-file-noselect to-find-fname))
              (goto-line (string-to-number to-find-line))))
          (with-current-buffer outbuf-name
            (kill-buffer outbuf-name)))))))


(defun diffscuss-show-source-rev (source-file rev line-num old-or-new)

  (let ((elength (length ending)))
    (string= (substring s (- 0 elength)) ending)))

(defun diffscuss-previous-comment ()
  "Jump to the previous comment."
  (interactive)
