summaryrefslogtreecommitdiff
path: root/lisp/ibuf-ext.el
diff options
context:
space:
mode:
authorRoland Winkler <winkler@gnu.org>2012-09-23 06:54:50 -0500
committerRoland Winkler <winkler@gnu.org>2012-09-23 06:54:50 -0500
commit6fab02746b865525b6fae7d16a4d3ed990f81723 (patch)
tree7564b41bcffefcf57545d954ac48548b9a862fb5 /lisp/ibuf-ext.el
parente109c4a6514ce0e930f63df1ead56eda1703afcf (diff)
downloademacs-6fab02746b865525b6fae7d16a4d3ed990f81723.tar.gz
lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read if not needed
Diffstat (limited to 'lisp/ibuf-ext.el')
-rw-r--r--lisp/ibuf-ext.el14
1 files changed, 10 insertions, 4 deletions
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))