changeset 45162:b266348db08f

(ibuffer-pop-filter-group): Doc fix. (ibuffer-clear-filter-groups): Likewise. (ibuffer-kill-filter-group): Likewise. (ibuffer-kill-line): Likewise. (ibuffer-read-filter-group-name): New function. (ibuffer-jump-to-filter-group): Use it. (ibuffer-kill-filter-group): Likewise. (ibuffer-yank-filter-group): Likewise. (ibuffer-decompose-filter-group): New function.
author Colin Walters <walters@gnu.org>
date Tue, 07 May 2002 08:13:13 +0000
parents 91602250e999
children 58815b772067
files lisp/ibuf-ext.el
diffstat 1 files changed, 35 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ibuf-ext.el	Tue May 07 08:11:41 2002 +0000
+++ b/lisp/ibuf-ext.el	Tue May 07 08:13:13 2002 +0000
@@ -554,18 +554,37 @@
 
 ;;;###autoload
 (defun ibuffer-pop-filter-group ()
-  "Remove the first filtering group."
+  "Remove the first filter group."
   (interactive)
   (when (null ibuffer-filter-groups)
-    (error "No filtering groups active"))
+    (error "No filter groups active"))
   (setq ibuffer-hidden-filter-groups
 	(delete (pop ibuffer-filter-groups)
 		ibuffer-hidden-filter-groups))
   (ibuffer-update nil t))
 
+(defun ibuffer-read-filter-group-name (msg &optional nodefault noerror)
+  (when (and (not noerror) (null ibuffer-filter-groups))
+    (error "No filter groups active"))
+  (let ((groups (mapcar #'car ibuffer-filter-groups)))
+    (completing-read msg (if nodefault
+			     groups
+			   (cons "Default" groups))
+		     nil t)))
+
+;;;###autoload
+(defun ibuffer-decompose-filter-group (group)
+  "Decompose the filter group GROUP into active filters."
+  (interactive (list (ibuffer-read-filter-group-name "Decompose filter group: " t)))
+  (let ((data (cdr (assoc group ibuffer-filter-groups))))
+    (setq ibuffer-filter-groups (ibuffer-delete-alist
+				 group ibuffer-filter-groups)
+	  ibuffer-filtering-qualifiers data))
+  (ibuffer-update nil t))
+
 ;;;###autoload
 (defun ibuffer-clear-filter-groups ()
-  "Remove all filtering groups."
+  "Remove all filter groups."
   (interactive)
   (setq ibuffer-filter-groups nil
 	ibuffer-hidden-filter-groups nil)
@@ -590,24 +609,18 @@
 ;;;###autoload
 (defun ibuffer-jump-to-filter-group (name)
   "Move point to the filter group whose name is NAME."
-  (interactive (list nil))
-  (let ((table (ibuffer-current-filter-groups-with-position)))
-    (when (interactive-p)
-      (setq name (completing-read "Jump to filter group: " table nil t)))
-    (ibuffer-aif (assoc name table)
-	(goto-char (cdr it))
-      (error "No filter group with name %s" name))))
+  (interactive (list (ibuffer-read-filter-group-name "Jump to filter group: ")))
+  (ibuffer-aif (assoc name (ibuffer-current-filter-groups-with-position))
+      (goto-char (cdr it))
+    (error "No filter group with name %s" name)))
 
 ;;;###autoload
 (defun ibuffer-kill-filter-group (name)
-  "Kill the filtering group named NAME.
+  "Kill the filter group named NAME.
 The group will be added to `ibuffer-filter-group-kill-ring'."
-  (interactive (list nil))
-  (when (interactive-p)
-    (setq name (completing-read "Kill filter group: "
-				ibuffer-filter-groups nil t)))
+  (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t)))
   (when (equal name "Default")
-    (error "Can't kill default filtering group"))
+    (error "Can't kill default filter group"))
   (ibuffer-aif (assoc name ibuffer-filter-groups)
       (progn
 	(push (copy-tree it) ibuffer-filter-group-kill-ring)
@@ -620,7 +633,7 @@
 
 ;;;###autoload
 (defun ibuffer-kill-line (&optional arg)
-  "Kill the filtering group at point.
+  "Kill the filter group at point.
 See also `ibuffer-kill-filter-group'."
   (interactive "P")
   (ibuffer-aif (save-excursion
@@ -656,12 +669,11 @@
 ;;;###autoload
 (defun ibuffer-yank-filter-group (name)
   "Yank the last killed filter group before group named NAME."
-  (interactive (list nil))
-  (unless ibuffer-filter-group-kill-ring
-    (error "ibuffer-filter-group-kill-ring is empty"))
-  (when (and (not name) (interactive-p))
-    (setq name (completing-read "Yank filter group before group: "
-				ibuffer-filter-groups nil t)))
+  (interactive (list (progn
+		       (unless ibuffer-filter-group-kill-ring
+			 (error "ibuffer-filter-group-kill-ring is empty"))
+		       (ibuffer-read-filter-group-name
+			"Yank filter group before group: "))))
   (save-excursion
     (ibuffer-forward-line 0)
     (ibuffer-insert-filter-group-before (pop ibuffer-filter-group-kill-ring)