From 6fab02746b865525b6fae7d16a4d3ed990f81723 Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Sun, 23 Sep 2012 06:54:50 -0500 Subject: [PATCH] lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read if not needed --- lisp/ChangeLog | 6 ++++++ lisp/ibuf-ext.el | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 40c9f6c2c51..29affbdcbbf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-09-23 Roland Winkler + + * ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): If list + ibuffer-saved-filter-groups has one element, shortcut the call of + completing-read. (Bug#12331) + 2012-09-23 Chong Yidong * bindings.el (mode-line-toggle-read-only): diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 97df90a65af..ee5bd0f357a 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -755,10 +755,16 @@ They are removed from `ibuffer-saved-filter-groups'." The value from `ibuffer-saved-filter-groups' is used." (interactive (list - (if (null ibuffer-saved-filter-groups) - (error "No saved filters") - (completing-read "Switch to saved filter group: " - ibuffer-saved-filter-groups nil t)))) + (cond ((null ibuffer-saved-filter-groups) + (error "No saved filters")) + ;; `ibuffer-saved-filter-groups' is a user variable that defaults + ;; to nil. We assume that with one element in this list the user + ;; knows what she wants. See bug#12331. + ((null (cdr ibuffer-saved-filter-groups)) + (caar ibuffer-saved-filter-groups)) + (t + (completing-read "Switch to saved filter group: " + ibuffer-saved-filter-groups nil t))))) (setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups)) ibuffer-hidden-filter-groups nil) (ibuffer-update nil t)) -- 2.39.2