summaryrefslogtreecommitdiff
path: root/ibuffer.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-01-09 14:22:00 +0800
committerJSDurand <mmemmew@gmail.com>2021-01-09 14:22:00 +0800
commitdc206ebe9397d656971ba7fc3a092009ef4e797a (patch)
treed963873011122fdf0eafeba89afd487115994bc5 /ibuffer.el
parenta2f7f2bf9077ba8acfc550575b9e21aa9ffe7bae (diff)
temporary state
Diffstat (limited to 'ibuffer.el')
-rw-r--r--ibuffer.el56
1 files changed, 56 insertions, 0 deletions
diff --git a/ibuffer.el b/ibuffer.el
new file mode 100644
index 0000000..2033bba
--- /dev/null
+++ b/ibuffer.el
@@ -0,0 +1,56 @@
+;;; -*- lexical-binding: t; -*-
+
+(require 'ibuffer)
+(require 'ibuf-ext)
+
+(setq ibuffer-expert t
+ ibuffer-display-summary nil)
+
+(setq ibuffer-show-empty-filter-groups nil)
+
+;;; a temporary binding
+
+(define-key global-map (vector 24 2) #'ibuffer)
+(define-key global-map (vector ?\s-b) #'ibuffer)
+
+(define-key ibuffer-mode-map (vector ?d) #'ibuffer-do-delete)
+(define-key ibuffer-mode-map (vector ?D) #'ibuffer-mark-for-delete)
+
+;;; filter for bongo
+
+;;;###autoload
+(define-ibuffer-filter durand-bongo
+ "Group bongo buffers together."
+ (:description "Bongo buffers together"
+ :reader (read-string "no effect: "))
+ (cond
+ ((not (boundp 'durand-bongo-music-dir))
+ (load-config "bongo.el")))
+ (with-current-buffer buf
+ (cond
+ ((derived-mode-p 'dired-mode)
+ (let ((bongo-dirs durand-bongo-music-dir)
+ found)
+ (while (and (not found)
+ (consp bongo-dirs))
+ (cond
+ ((file-in-directory-p default-directory (car bongo-dirs))
+ (setq found t))
+ (t (setq bongo-dirs (cdr bongo-dirs)))))
+ found))
+ ((derived-mode-p 'bongo-playlist-mode 'bongo-library-mode)))))
+
+;;;###autoload
+(defun durand-bongo-set-filter ()
+ "Set my custom filters."
+ (interactive)
+ (setq ibuffer-filter-groups
+ (cons (cons "Bongo" '((durand-bongo)))
+ ibuffer-filter-groups))
+ (let ((ibuf (get-buffer "*Ibuffer*")))
+ (when ibuf
+ (with-current-buffer ibuf
+ ;; (pop-to-buffer ibuf)
+ (ibuffer-update nil t)))))
+
+(add-hook 'ibuffer-hook 'durand-bongo-set-filter 100)