From d024fb4ec9dd59c0364e01768514ef67e2d17457 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 14 Aug 2011 14:08:20 -0400 Subject: [PATCH] Avoid deleting ibuffer named filters by default. * lisp/ibuf-ext.el (ibuffer-filter-disable): New arg for deleting filter groups. (ibuffer-included-in-filter-p-1): Use it. Suggested by Noam Postavsky. Fixes: debbugs:8804 --- lisp/ChangeLog | 7 +++++++ lisp/ibuf-ext.el | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 07f45b34a54..510f594465c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2011-08-14 Chong Yidong + + * ibuf-ext.el (ibuffer-filter-disable): New arg for deleting + filter groups. + (ibuffer-included-in-filter-p-1): Use it. Suggested by Noam + Postavsky (Bug#8804). + 2011-08-12 Juanma Barranquero * startup.el (argi): Declare as global variable (bug#9275). diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index f4b729458e6..073efaeee2a 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -505,7 +505,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." (assoc (cdr filter) ibuffer-saved-filters))) (unless data - (ibuffer-filter-disable) + (ibuffer-filter-disable t) (error "Unknown saved filter %s" (cdr filter))) (ibuffer-included-in-filters-p buf (cadr data)))) (t @@ -514,7 +514,7 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'." ;; filterdat should be like (TYPE DESCRIPTION FUNC) ;; just a sanity check (unless filterdat - (ibuffer-filter-disable) + (ibuffer-filter-disable t) (error "Undefined filter %s" (car filter))) (not (not @@ -768,11 +768,14 @@ The value from `ibuffer-saved-filter-groups' is used." (ibuffer-update nil t)) ;;;###autoload -(defun ibuffer-filter-disable () - "Disable all filters currently in effect in this buffer." +(defun ibuffer-filter-disable (&optional delete-filter-groups) + "Disable all filters currently in effect in this buffer. +With optional arg DELETE-FILTER-GROUPS non-nil, delete all filter +group definitions by setting `ibuffer-filter-groups' to nil." (interactive) - (setq ibuffer-filtering-qualifiers nil - ibuffer-filter-groups nil) + (setq ibuffer-filtering-qualifiers nil) + (if delete-filter-groups + (setq ibuffer-filter-groups nil)) (let ((buf (ibuffer-current-buffer))) (ibuffer-update nil t) (when buf -- 2.39.2