;;; buffery.el --- Buffer view with Taxy grouping -*- lexical-binding: t; -*- ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; ;;; Code: (require 'cl-lib) (require 'project) (require 'taxy) (require 'taxy-magit-section) (defvar buffery-taxy (cl-labels ((directory (buffer) (buffer-local-value 'default-directory buffer)) (mode (buffer) (prin1-to-string (buffer-local-value 'major-mode buffer))) (project (buffer) (with-current-buffer buffer (when-let ((project (project-current))) (project-root project)))) (specialp (buffer) (when (not (buffer-file-name buffer)) "*special*")) (make-fn (&rest args) (apply #'make-taxy-magit-section :make #'make-fn :format-fn #'buffer-name args))) (make-fn :name "Buffers" :take (apply-partially #'taxy-take-keyed (list (list #'project) (list #'specialp) #'directory #'mode))))) (defun buffery () (interactive) (let* ((buffers (buffer-list)) (buffer (get-buffer-create "*Buffery*")) (inhibit-read-only t)) (with-current-buffer buffer (erase-buffer) (thread-last buffery-taxy taxy-emptied (taxy-fill buffers) (taxy-sort* #'string< #'taxy-name) taxy-magit-section-insert)) (pop-to-buffer buffer))) (provide 'buffery) ;;; buffery.el ends here