comparison .elisp/settings/50.localfuncs.el @ 295:026344f083ef

af-generic-diff-repo: use monky or magit if available
author Augie Fackler <raf@durin42.com>
date Mon, 12 Nov 2012 16:27:49 -0600
parents 3d5c595c229e
children
comparison
equal deleted inserted replaced
294:a8caf664abdc 295:026344f083ef
15 (let ((ido-enable-flex-matching (< (* (length (ad-get-arg 0)) (length ido-text)) 15 (let ((ido-enable-flex-matching (< (* (length (ad-get-arg 0)) (length ido-text))
16 af-ido-flex-fuzzy-limit))) 16 af-ido-flex-fuzzy-limit)))
17 ad-do-it)) 17 ad-do-it))
18 18
19 ;; Generic repository differ. Requires textmate.el and mercurial.el. 19 ;; Generic repository differ. Requires textmate.el and mercurial.el.
20 ;; Will use monky or magit if either one is present.
20 (defun af-generic-diff-repo () 21 (defun af-generic-diff-repo ()
21 (interactive) 22 (interactive)
22 (let ((root (textmate-project-root))) 23 (let ((root (textmate-project-root)))
23 (cd root) 24 (cond ((and (string= (textmate-project-root-type root) "hg") (fboundp 'monky-status)) (monky-status))
24 (hg-view-output 25 ((and (string= (textmate-project-root-type root) "git") (fboundp 'magit-status)) (magit-status root))
25 ((format "project diff for %s" root)) 26 (t (progn
26 (call-process (textmate-project-root-type root) nil t nil "diff") 27 (cd root)
27 (diff-mode) 28 (hg-view-output
28 (setq diff (not (= (point-min) (point-max)))) 29 ((format "project diff for %s" root))
29 (font-lock-fontify-buffer) 30 (call-process (textmate-project-root-type root) nil t nil "diff")
30 (cd root)))) 31 (diff-mode)
32 (setq diff (not (= (point-min) (point-max))))
33 (font-lock-fontify-buffer)
34 (cd root)))))))
35
31 (global-set-key [(control c)(t)(=)] 'af-generic-diff-repo) 36 (global-set-key [(control c)(t)(=)] 'af-generic-diff-repo)
32 (global-set-key [(control c)(d)] 'af-generic-diff-repo) 37 (global-set-key [(control c)(d)] 'af-generic-diff-repo)
38
33 39
34 (defun af-rotate-list (l) 40 (defun af-rotate-list (l)
35 "Move the head of l to the end of the list." 41 "Move the head of l to the end of the list."
36 (append (cdr l) (list (car l)))) 42 (append (cdr l) (list (car l))))
37 43