# HG changeset patch # User Augie Fackler # Date 1352759269 21600 # Node ID 026344f083ef3cb5753e1855070636bd9e7dcd84 # Parent a8caf664abdca4ed2c5569a4d89772a924179f99 af-generic-diff-repo: use monky or magit if available diff --git a/.elisp/settings/50.localfuncs.el b/.elisp/settings/50.localfuncs.el --- a/.elisp/settings/50.localfuncs.el +++ b/.elisp/settings/50.localfuncs.el @@ -17,20 +17,26 @@ spends an eternity in a regex if you mak 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))))