From 2483d2dbd715c4bd892d1fbc968a17a01888cb2d Mon Sep 17 00:00:00 2001 From: muffinmad Date: Fri, 5 Feb 2021 21:40:33 +0200 Subject: [PATCH] Fix #4 use project-root[s] to get project root --- ibuffer-project.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ibuffer-project.el b/ibuffer-project.el index 2320e4f..56d023f 100644 --- a/ibuffer-project.el +++ b/ibuffer-project.el @@ -5,7 +5,7 @@ ;; Author: Andrii Kolomoiets ;; 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. @@ -75,6 +75,7 @@ (require 'ibuffer) (require 'ibuf-ext) +(require 'project) (defgroup ibuffer-project nil "Group ibuffer entries by project." @@ -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: