summary refs log tree commit diff
path: root/emacs.d/modules/module-ibuffer.el
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2018-04-08 16:13:12 -0700
committerFranck Cuny <franck.cuny@gmail.com>2018-04-08 16:13:12 -0700
commit4007ca81e0105119c8ed754e654a731934f5154c (patch)
tree41ba9d60f64866c8a098e631e8e32bf4249931fa /emacs.d/modules/module-ibuffer.el
parent[emacs] fix some path after directories reorg (diff)
downloademacs.d-4007ca81e0105119c8ed754e654a731934f5154c.tar.gz
[emacs] Large refactoring.
At first I wanted to add support for java, and then I realized that
maintaining a giant file with all the packages was not working as I
was expected.

The configuration is broken down to multiple files now, with each
major mode in a separate file, and the main modules in their own too.

This should make it easier to maintain and organize.
Diffstat (limited to 'emacs.d/modules/module-ibuffer.el')
-rw-r--r--emacs.d/modules/module-ibuffer.el42
1 files changed, 42 insertions, 0 deletions
diff --git a/emacs.d/modules/module-ibuffer.el b/emacs.d/modules/module-ibuffer.el
new file mode 100644
index 0000000..f914069
--- /dev/null
+++ b/emacs.d/modules/module-ibuffer.el
@@ -0,0 +1,42 @@
+(require 'config-package)
+
+(use-package ibuffer
+  :bind ("C-x C-b" . ibuffer)
+  :init
+  (setq-default ibuffer-eliding-string "…")
+  (setq ibuffer-show-empty-filter-groups nil
+        ibuffer-formats '((mark modified read-only " "
+                                (name 30 30 :left :elide)
+                                " "
+                                (size 9 -1 :right)
+                                " "
+                                (mode 16 16 :left :elide)
+                                " " filename-and-process)
+                          (mark " "
+                                (name 16 -1)
+                                " " filename))
+        ibuffer-saved-filter-groups
+        (quote (("default"
+                 ("dired"  (mode . dired-mode))
+                 ("elisp"  (mode . emacs-lisp-mode))
+                 ("emacs"  (or (name . "^\\*.*\\*$") (mode . fundamental-mode)))
+                 ("go"     (mode . go-mode))
+                 ("java"   (mode . java-mode))
+                 ("json"   (mode . json-mode))
+                 ("lisp"   (mode . lisp-mode))
+                 ("magit"  (mode . magit-mode))
+                 ("puppet" (mode . puppet-mode))
+                 ("python" (mode . python-mode))
+                 ("repl"   (name . "repl"))
+                 ("ruby"   (mode . ruby-mode))
+                 ("rust"   (mode . rust-mode))
+                 ("sh"     (mode . sh-mode))
+                 ("text"   (mode . text-mode))))))
+
+  (add-hook 'ibuffer-mode-hook  ;; organise by filter-groups
+            '(lambda ()
+               (ibuffer-auto-mode 1)
+               (setq mode-name "≣")
+               (ibuffer-switch-to-saved-filter-groups "default"))))
+
+(provide 'module-ibuffer)