changeset 68580:43619387ab52

(ibuffer-compressed-file-name-regexp): New defcustom. (ibuffer-fontification-alist): Use it. (ibuffer-mode-map): Bind `ibuffer-mark-compressed-file-buffers' to "* z" and the Ibuffer Mark menu.
author John Paul Wallington <jpw@pobox.com>
date Thu, 02 Feb 2006 21:55:33 +0000
parents d378b1eeef10
children 0a74d0792db2
files lisp/ibuffer.el
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ibuffer.el	Thu Feb 02 16:49:58 2006 +0000
+++ b/lisp/ibuffer.el	Thu Feb 02 21:55:33 2006 +0000
@@ -142,12 +142,16 @@
 
 (defcustom ibuffer-fontification-alist
   `((10 buffer-read-only font-lock-constant-face)
-    (15 (string-match "^*" (buffer-name)) font-lock-keyword-face)
-    (20 (and (string-match "^ " (buffer-name))
+    (15 (and buffer-file-name
+	     (string-match ibuffer-compressed-file-name-regexp
+			   buffer-file-name))
+	font-lock-doc-face)
+    (20 (string-match "^*" (buffer-name)) font-lock-keyword-face)
+    (25 (and (string-match "^ " (buffer-name))
 	     (null buffer-file-name))
 	italic)
-    (25 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
-    (30 (eq major-mode 'dired-mode) font-lock-function-name-face))
+    (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
+    (35 (eq major-mode 'dired-mode) font-lock-function-name-face))
   "An alist describing how to fontify buffers.
 Each element should be of the form (PRIORITY FORM FACE), where
 PRIORITY is an integer, FORM is an arbitrary form to evaluate in the
@@ -320,6 +324,14 @@
   :type '(repeat function)
   :group 'ibuffer)
 
+(defcustom ibuffer-compressed-file-name-regexp
+  (concat "\\.\\("
+	(regexp-opt '("arj" "bgz" "bz2" "gz" "lzh" "taz" "tgz" "zip" "z"))
+	"\\)$")
+  "Regexp to match compressed file names."
+  :type 'regexp
+  :group 'ibuffer)
+
 (defcustom ibuffer-hook nil
   "Hook run when `ibuffer' is called."
   :type 'hook
@@ -403,6 +415,7 @@
     (define-key map (kbd "* /") 'ibuffer-mark-dired-buffers)
     (define-key map (kbd "* e") 'ibuffer-mark-dissociated-buffers)
     (define-key map (kbd "* h") 'ibuffer-mark-help-buffers)
+    (define-key map (kbd "* z") 'ibuffer-mark-compressed-file-buffers)
     (define-key map (kbd ".") 'ibuffer-mark-old-buffers)
 
     (define-key map (kbd "d") 'ibuffer-mark-for-delete)
@@ -718,6 +731,9 @@
     (define-key-after map [menu-bar mark mark-help-buffers]
       '(menu-item "Mark help buffers" ibuffer-mark-help-buffers
 		  :help "Mark buffers in help-mode"))
+    (define-key-after map [menu-bar mark mark-compressed-file-buffers]
+      '(menu-item "Mark compressed file buffers" ibuffer-mark-compressed-file-buffers
+		  :help "Mark buffers which have a file that is compressed"))
     (define-key-after map [menu-bar mark mark-old-buffers]
       '(menu-item "Mark old buffers" ibuffer-mark-old-buffers
 		  :help "Mark buffers which have not been viewed recently"))