diff options
author | Michael Olson <mwolson@gnu.org> | 2008-08-08 08:59:56 -0700 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2008-08-08 09:00:14 -0700 |
commit | cf588f5ea96b7523965ac48bc39e6d9d2dc4e828 (patch) | |
tree | 8df3debe1ea84de25e0c6111a6b47e1ff59b8059 /lisp/emms.el | |
parent | 616f160c7f783dc232f68ea6ab8b40a36f690b18 (diff) |
Introduce emms-completing-read.
This allows users to specify which completing-read function to use,
defaulting to ido-completing-read. The relevant option is
emms-completing-read-function.
Thanks to Thierry Volpiatto for the idea.
Diffstat (limited to 'lisp/emms.el')
-rw-r--r-- | lisp/emms.el | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/emms.el b/lisp/emms.el index 1d8e827..b74c687 100644 --- a/lisp/emms.el +++ b/lisp/emms.el @@ -86,6 +86,18 @@ track by track normally." :group 'emms :type 'boolean) +(defcustom emms-completing-read-function + (if (and (boundp 'ido-mode) + ido-mode) + 'ido-completing-read + 'completing-read) + "Function to call when prompting user to choose between a list of options. +This should take the same arguments as `completing-read'. +Some possible values are `completing-read' and `ido-completing-read'. +Note that you must set `ido-mode' if using`ido-completing-read'." + :group 'emms + :type 'function) + (defcustom emms-track-description-function 'emms-track-simple-description "*Function for describing an EMMS track in a user-friendly way." :group 'emms @@ -502,6 +514,13 @@ See `emms-repeat-track'." (when (not emms-player-playing-p) (error "No EMMS player playing right now"))) +(defun emms-completing-read (&rest args) + "Read a string in the minibuffer, with completion. +Set `emms-completing-read' to determine which function to use. + +See `completing-read' for a description of ARGS." + (apply emms-completing-read-function args)) + ;;; Compatibility functions @@ -671,8 +690,8 @@ for that purpose.") #'(lambda (lbuf rbuf) (< (length (car lbuf)) (length (car rbuf))))))))) - (completing-read "Playlist buffer to make current: " - buf-list nil t default)))) + (emms-completing-read "Playlist buffer to make current: " + buf-list nil t default)))) (let ((buf (if buffer (get-buffer buffer) (current-buffer)))) |