Skip to content

Commit

Permalink
Fix #4 use project-root[s] to get project root
Browse files Browse the repository at this point in the history
  • Loading branch information
muffinmad committed Feb 5, 2021
1 parent 8cc8c96 commit 2483d2d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ibuffer-project.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Andrii Kolomoiets <[email protected]>
;; Keywords: tools
;; URL: https://github.com/muffinmad/emacs-ibuffer-project
;; Package-Version: 2.0
;; Package-Version: 2.1
;; Package-Requires: ((emacs "25.1"))

;; This file is NOT part of GNU Emacs.
Expand Down Expand Up @@ -75,6 +75,7 @@

(require 'ibuffer)
(require 'ibuf-ext)
(require 'project)

(defgroup ibuffer-project nil
"Group ibuffer entries by project."
Expand All @@ -98,7 +99,15 @@ To clear cache use `ibuffer-project-clear-cache' command."
(ibuffer-project-clear-cache)
(set-default s v))

(defcustom ibuffer-project-root-functions '(((lambda (dir) (cdr (project-current nil dir))) . "Project")
(defun ibuffer-project-project-root (dir)
"Get project root in DIR."
(let ((project (project-current nil dir)))
(and project
(if (functionp 'project-root)
(project-root project)
(car (project-roots project))))))

(defcustom ibuffer-project-root-functions '((ibuffer-project-project-root . "Project")
(identity . "Directory"))
"Functions to get root to group by.
Cons of each item can be:
Expand Down

0 comments on commit 2483d2d

Please sign in to comment.