comparison lisp/ibuf-ext.el @ 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 18c2dfafd097
children 580bcb04cd4f
comparison
equal deleted inserted replaced
45161:91602250e999 45162:b266348db08f
552 (delq 'ibuffer-mode modes))))) 552 (delq 'ibuffer-mode modes)))))
553 (ibuffer-update nil t)) 553 (ibuffer-update nil t))
554 554
555 ;;;###autoload 555 ;;;###autoload
556 (defun ibuffer-pop-filter-group () 556 (defun ibuffer-pop-filter-group ()
557 "Remove the first filtering group." 557 "Remove the first filter group."
558 (interactive) 558 (interactive)
559 (when (null ibuffer-filter-groups) 559 (when (null ibuffer-filter-groups)
560 (error "No filtering groups active")) 560 (error "No filter groups active"))
561 (setq ibuffer-hidden-filter-groups 561 (setq ibuffer-hidden-filter-groups
562 (delete (pop ibuffer-filter-groups) 562 (delete (pop ibuffer-filter-groups)
563 ibuffer-hidden-filter-groups)) 563 ibuffer-hidden-filter-groups))
564 (ibuffer-update nil t)) 564 (ibuffer-update nil t))
565 565
566 (defun ibuffer-read-filter-group-name (msg &optional nodefault noerror)
567 (when (and (not noerror) (null ibuffer-filter-groups))
568 (error "No filter groups active"))
569 (let ((groups (mapcar #'car ibuffer-filter-groups)))
570 (completing-read msg (if nodefault
571 groups
572 (cons "Default" groups))
573 nil t)))
574
575 ;;;###autoload
576 (defun ibuffer-decompose-filter-group (group)
577 "Decompose the filter group GROUP into active filters."
578 (interactive (list (ibuffer-read-filter-group-name "Decompose filter group: " t)))
579 (let ((data (cdr (assoc group ibuffer-filter-groups))))
580 (setq ibuffer-filter-groups (ibuffer-delete-alist
581 group ibuffer-filter-groups)
582 ibuffer-filtering-qualifiers data))
583 (ibuffer-update nil t))
584
566 ;;;###autoload 585 ;;;###autoload
567 (defun ibuffer-clear-filter-groups () 586 (defun ibuffer-clear-filter-groups ()
568 "Remove all filtering groups." 587 "Remove all filter groups."
569 (interactive) 588 (interactive)
570 (setq ibuffer-filter-groups nil 589 (setq ibuffer-filter-groups nil
571 ibuffer-hidden-filter-groups nil) 590 ibuffer-hidden-filter-groups nil)
572 (ibuffer-update nil t)) 591 (ibuffer-update nil t))
573 592
588 (nreverse result)))) 607 (nreverse result))))
589 608
590 ;;;###autoload 609 ;;;###autoload
591 (defun ibuffer-jump-to-filter-group (name) 610 (defun ibuffer-jump-to-filter-group (name)
592 "Move point to the filter group whose name is NAME." 611 "Move point to the filter group whose name is NAME."
593 (interactive (list nil)) 612 (interactive (list (ibuffer-read-filter-group-name "Jump to filter group: ")))
594 (let ((table (ibuffer-current-filter-groups-with-position))) 613 (ibuffer-aif (assoc name (ibuffer-current-filter-groups-with-position))
595 (when (interactive-p) 614 (goto-char (cdr it))
596 (setq name (completing-read "Jump to filter group: " table nil t))) 615 (error "No filter group with name %s" name)))
597 (ibuffer-aif (assoc name table)
598 (goto-char (cdr it))
599 (error "No filter group with name %s" name))))
600 616
601 ;;;###autoload 617 ;;;###autoload
602 (defun ibuffer-kill-filter-group (name) 618 (defun ibuffer-kill-filter-group (name)
603 "Kill the filtering group named NAME. 619 "Kill the filter group named NAME.
604 The group will be added to `ibuffer-filter-group-kill-ring'." 620 The group will be added to `ibuffer-filter-group-kill-ring'."
605 (interactive (list nil)) 621 (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t)))
606 (when (interactive-p)
607 (setq name (completing-read "Kill filter group: "
608 ibuffer-filter-groups nil t)))
609 (when (equal name "Default") 622 (when (equal name "Default")
610 (error "Can't kill default filtering group")) 623 (error "Can't kill default filter group"))
611 (ibuffer-aif (assoc name ibuffer-filter-groups) 624 (ibuffer-aif (assoc name ibuffer-filter-groups)
612 (progn 625 (progn
613 (push (copy-tree it) ibuffer-filter-group-kill-ring) 626 (push (copy-tree it) ibuffer-filter-group-kill-ring)
614 (setq ibuffer-filter-groups (ibuffer-delete-alist 627 (setq ibuffer-filter-groups (ibuffer-delete-alist
615 name ibuffer-filter-groups)) 628 name ibuffer-filter-groups))
618 (error "No filter group with name \"%s\"" name)) 631 (error "No filter group with name \"%s\"" name))
619 (ibuffer-update nil t)) 632 (ibuffer-update nil t))
620 633
621 ;;;###autoload 634 ;;;###autoload
622 (defun ibuffer-kill-line (&optional arg) 635 (defun ibuffer-kill-line (&optional arg)
623 "Kill the filtering group at point. 636 "Kill the filter group at point.
624 See also `ibuffer-kill-filter-group'." 637 See also `ibuffer-kill-filter-group'."
625 (interactive "P") 638 (interactive "P")
626 (ibuffer-aif (save-excursion 639 (ibuffer-aif (save-excursion
627 (ibuffer-forward-line 0) 640 (ibuffer-forward-line 0)
628 (get-text-property (point) 'ibuffer-filter-group-name)) 641 (get-text-property (point) 'ibuffer-filter-group-name))
654 (error "No filter group at point")))) 667 (error "No filter group at point"))))
655 668
656 ;;;###autoload 669 ;;;###autoload
657 (defun ibuffer-yank-filter-group (name) 670 (defun ibuffer-yank-filter-group (name)
658 "Yank the last killed filter group before group named NAME." 671 "Yank the last killed filter group before group named NAME."
659 (interactive (list nil)) 672 (interactive (list (progn
660 (unless ibuffer-filter-group-kill-ring 673 (unless ibuffer-filter-group-kill-ring
661 (error "ibuffer-filter-group-kill-ring is empty")) 674 (error "ibuffer-filter-group-kill-ring is empty"))
662 (when (and (not name) (interactive-p)) 675 (ibuffer-read-filter-group-name
663 (setq name (completing-read "Yank filter group before group: " 676 "Yank filter group before group: "))))
664 ibuffer-filter-groups nil t)))
665 (save-excursion 677 (save-excursion
666 (ibuffer-forward-line 0) 678 (ibuffer-forward-line 0)
667 (ibuffer-insert-filter-group-before (pop ibuffer-filter-group-kill-ring) 679 (ibuffer-insert-filter-group-before (pop ibuffer-filter-group-kill-ring)
668 name)) 680 name))
669 (ibuffer-update nil t)) 681 (ibuffer-update nil t))