summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-12-19 14:52:57 +0800
committerJSDurand <mmemmew@gmail.com>2021-12-19 14:52:57 +0800
commit5849cd830f00d67483c98f713ae42ba189cf039a (patch)
tree13810293bc15b7f02031aef6dcc32042d7a7e207
parent34c09ddc9883d6e9116001b068f5235381d420ce (diff)
ibuffer: a custom column
* ibuffer.el (protect): A custom column. (ibuffer-formats): Add the newly defined column to the list of formats.
-rw-r--r--ibuffer.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/ibuffer.el b/ibuffer.el
index 4944c3a..4b862c1 100644
--- a/ibuffer.el
+++ b/ibuffer.el
@@ -257,6 +257,34 @@ derived modes of `ibuffer-mode'.")))
(advice-add #'ibuffer-do-unprotect :before
#'durand-ibuffer-restore-mark-before-advice)
+;;;; A custom column
+
+;;;###autoload
+(define-ibuffer-column protect
+ (:name "P" :inline t)
+ (cond
+ ((durand-member buffer durand-clear-passlist #'durand-born-equal)
+ "P")
+ (" ")))
+
+(setq ibuffer-formats
+ '((mark
+ modified
+ read-only
+ locked
+ protect
+ " "
+ (name 18 18 :left :elide)
+ " "
+ (size 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " "
+ filename-and-process)
+ (mark " " (name 16 -1) " " filename)))
+
+(ibuffer-recompile-formats)
+
;;; key-bindings
(define-key global-map (vector 24 2) #'ibuffer)