Put back magit-list-buffers' and magit-list-projects' as they might come in handy to others.

This commit is contained in:
Phil Jackson 2010-05-12 23:34:04 +01:00
parent 75941be63b
commit 11c14b6357

View file

@ -4047,6 +4047,34 @@ With prefix force the removal even it it hasn't been merged."
((diff)
(magit-interactive-resolve (cadr info)))))
(provide 'magit)
(defun magit-list-buffers ()
"Returns a list of magit buffers."
(delq nil (mapcar (lambda (b)
(save-excursion
(set-buffer b)
(when (eq major-mode 'magit-mode)
b)))
(buffer-list))))
(defun remove-dupes (list)
"Remove the duplicate items in a sorted list."
(let (tmp-list head)
(while list
(setq head (pop list))
(unless (equal head (car list))
(push head tmp-list)))
(reverse tmp-list)))
(defun magit-list-projects ()
"Returns a list of directories with a magit representation."
(remove-dupes
(sort
(mapcar (lambda (b)
(save-excursion
(set-buffer b)
(directory-file-name default-directory)))
(magit-list-buffers))
'string=)))
(provide 'magit)
;;; magit.el ends here