Mercurial > emacs
comparison lisp/ibuf-ext.el @ 69642:297538763ac1
(ibuffer-read-filter-group-name):
Use `ibuffer-generate-filter-groups' to make completion list match
the filter groups that are really displayed in the Ibuffer buffer.
(ibuffer-generate-filter-groups): Add new args noempty, nodefault.
author | Romain Francoise <romain@orebokech.com> |
---|---|
date | Thu, 23 Mar 2006 07:05:33 +0000 |
parents | b47862df4a6b |
children | a13e990ebd44 e6bf73e43cf4 |
comparison
equal
deleted
inserted
replaced
69641:f3cbe79b8375 | 69642:297538763ac1 |
---|---|
509 (not | 509 (not |
510 (funcall (caddr filterdat) | 510 (funcall (caddr filterdat) |
511 buf | 511 buf |
512 (cdr filter)))))))))) | 512 (cdr filter)))))))))) |
513 | 513 |
514 (defun ibuffer-generate-filter-groups (bmarklist) | 514 (defun ibuffer-generate-filter-groups (bmarklist &optional noempty nodefault) |
515 (let ((filter-group-alist (append ibuffer-filter-groups | 515 (let ((filter-group-alist (if nodefault |
516 (list (cons "Default" nil))))) | 516 ibuffer-filter-groups |
517 (append ibuffer-filter-groups | |
518 (list (cons "Default" nil)))))) | |
517 ;; (dolist (hidden ibuffer-hidden-filter-groups) | 519 ;; (dolist (hidden ibuffer-hidden-filter-groups) |
518 ;; (setq filter-group-alist (ibuffer-delete-alist | 520 ;; (setq filter-group-alist (ibuffer-delete-alist |
519 ;; hidden filter-group-alist))) | 521 ;; hidden filter-group-alist))) |
520 (let ((vec (make-vector (length filter-group-alist) nil)) | 522 (let ((vec (make-vector (length filter-group-alist) nil)) |
521 (i 0)) | 523 (i 0)) |
527 filterset)) | 529 filterset)) |
528 bmarklist) | 530 bmarklist) |
529 (aset vec i hip-crowd) | 531 (aset vec i hip-crowd) |
530 (incf i) | 532 (incf i) |
531 (setq bmarklist lamers)))) | 533 (setq bmarklist lamers)))) |
532 (let ((ret nil)) | 534 (let (ret) |
533 (dotimes (j i ret) | 535 (dotimes (j i ret) |
534 (push (cons (car (nth j filter-group-alist)) | 536 (let ((bufs (aref vec j))) |
535 (aref vec j)) | 537 (unless (and noempty (null bufs)) |
536 ret)))))) | 538 (push (cons (car (nth j filter-group-alist)) |
539 bufs) | |
540 ret)))))))) | |
537 | 541 |
538 ;;;###autoload | 542 ;;;###autoload |
539 (defun ibuffer-filters-to-filter-group (name) | 543 (defun ibuffer-filters-to-filter-group (name) |
540 "Make the current filters into a filtering group." | 544 "Make the current filters into a filtering group." |
541 (interactive "sName for filtering group: ") | 545 (interactive "sName for filtering group: ") |
573 (ibuffer-update nil t)) | 577 (ibuffer-update nil t)) |
574 | 578 |
575 (defun ibuffer-read-filter-group-name (msg &optional nodefault noerror) | 579 (defun ibuffer-read-filter-group-name (msg &optional nodefault noerror) |
576 (when (and (not noerror) (null ibuffer-filter-groups)) | 580 (when (and (not noerror) (null ibuffer-filter-groups)) |
577 (error "No filter groups active")) | 581 (error "No filter groups active")) |
578 (let ((groups (mapcar #'car ibuffer-filter-groups))) | 582 ;; `ibuffer-generate-filter-groups' returns all non-hidden filter |
579 (completing-read msg (if nodefault | 583 ;; groups, possibly excluding empty groups or Default. |
580 groups | 584 ;; We add `ibuffer-hidden-filter-groups' to the list, excluding |
581 (cons "Default" groups)) | 585 ;; Default if necessary. |
582 nil t))) | 586 (completing-read msg (nconc |
587 (ibuffer-generate-filter-groups | |
588 (ibuffer-current-state-list) | |
589 (not ibuffer-show-empty-filter-groups) | |
590 nodefault) | |
591 (if nodefault | |
592 (remove "Default" ibuffer-hidden-filter-groups) | |
593 ibuffer-hidden-filter-groups)) | |
594 nil t)) | |
583 | 595 |
584 ;;;###autoload | 596 ;;;###autoload |
585 (defun ibuffer-decompose-filter-group (group) | 597 (defun ibuffer-decompose-filter-group (group) |
586 "Decompose the filter group GROUP into active filters." | 598 "Decompose the filter group GROUP into active filters." |
587 (interactive | 599 (interactive |