From: Roland Winkler Date: Sun, 23 Sep 2012 11:54:50 +0000 (-0500) Subject: lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read... X-Git-Tag: emacs-24.2.90~244^2~123 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6fab02746b865525b6fae7d16a4d3ed990f81723;p=emacs.git lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read if not needed --- 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))