Commit 6fab0274 authored by Roland Winkler's avatar Roland Winkler
Browse files

lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read if not needed

parent e109c4a6
2012-09-23 Roland Winkler <winkler@gnu.org>
* 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 <cyd@gnu.org>
 
* bindings.el (mode-line-toggle-read-only):
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment