+(defun icomplete-force-complete-and-exit ()
+ "Complete the minibuffer and exit.
+Use the first of the matches if there are any displayed, and use
+the default otherwise."
+ (interactive)
+ (if (or icomplete-show-matches-on-no-input
+ (> (icomplete--field-end) (icomplete--field-beg)))
+ (minibuffer-force-complete-and-exit)
+ (minibuffer-complete-and-exit)))
+