Permalink
Browse files

Sort sub-repos before parent repos so that buffers are correctly file…

…d into the most specific group
  • Loading branch information...
1 parent 3414da4 commit 8011a85c197f690a50f516e56e3a767f010d1d35 @purcell committed Apr 5, 2011
Showing with 8 additions and 5 deletions.
  1. +8 −5 ibuffer-vc.el
View
@@ -100,11 +100,14 @@ file is not under version control"
(defun ibuffer-vc-generate-filter-groups-by-vc-root ()
"Create a set of ibuffer filter groups based on the vc root dirs of buffers"
- (mapcar (lambda (vc-root)
- (cons (format "%s:%s" (car vc-root) (cdr vc-root))
- `((vc-root . ,(expand-file-name (cdr vc-root))))))
- (ibuffer-remove-duplicates
- (delq nil (mapcar 'ibuffer-vc-root (buffer-list))))))
+ (let ((roots (ibuffer-remove-duplicates
+ (delq nil (mapcar 'ibuffer-vc-root (buffer-list))))))
+ (sort roots (lambda (r1 r2)
+ (string-prefix-p (cdr r2) (cdr r1))))
+ (mapcar (lambda (vc-root)
+ (cons (format "%s:%s" (car vc-root) (cdr vc-root))
+ `((vc-root . ,(expand-file-name (cdr vc-root))))))
+ roots)))
;;;###autoload
(defun ibuffer-vc-set-filter-groups-by-vc-root ()

0 comments on commit 8011a85

Please sign in to comment.