Commits

Augie Fackler  committed 026344f

af-generic-diff-repo: use monky or magit if available

  • Participants
  • Parent commits a8caf66

Comments (0)

Files changed (1)

File .elisp/settings/50.localfuncs.el

     ad-do-it))
 
 ;; Generic repository differ. Requires textmate.el and mercurial.el.
+;; Will use monky or magit if either one is present.
 (defun af-generic-diff-repo ()
   (interactive)
   (let ((root (textmate-project-root)))
-    (cd root)
-    (hg-view-output
-        ((format "project diff for %s" root))
-      (call-process (textmate-project-root-type root) nil t nil "diff")
-      (diff-mode)
-      (setq diff (not (= (point-min) (point-max))))
-      (font-lock-fontify-buffer)
-      (cd root))))
+    (cond ((and (string= (textmate-project-root-type root) "hg") (fboundp 'monky-status)) (monky-status))
+          ((and (string= (textmate-project-root-type root) "git") (fboundp 'magit-status)) (magit-status root))
+          (t (progn
+               (cd root)
+               (hg-view-output
+                   ((format "project diff for %s" root))
+                 (call-process (textmate-project-root-type root) nil t nil "diff")
+                 (diff-mode)
+                 (setq diff (not (= (point-min) (point-max))))
+                 (font-lock-fontify-buffer)
+                 (cd root)))))))
+
 (global-set-key [(control c)(t)(=)] 'af-generic-diff-repo)
 (global-set-key [(control c)(d)] 'af-generic-diff-repo)
 
+
 (defun af-rotate-list (l)
   "Move the head of l to the end of the list."
   (append (cdr l) (list (car l))))