From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: `completing-read` without RET Date: Fri, 11 Mar 2016 08:08:08 -0800 (PST) Message-ID: <46dc9263-f168-4f2e-b052-120e1184fcba@default> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1457712530 9275 80.91.229.3 (11 Mar 2016 16:08:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 16:08:50 +0000 (UTC) To: Stefan Monnier , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 17:08:37 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aePcB-0002Ct-S0 for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 17:08:35 +0100 Original-Received: from localhost ([::1]:56167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aePcB-000618-4L for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 11:08:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aePbt-0005y7-4w for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 11:08:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aePbo-0003b8-3V for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 11:08:17 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:27310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aePbn-0003aw-SH for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 11:08:12 -0500 Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2BG8Anw004323 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Mar 2016 16:08:11 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u2BG8ARE029864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 11 Mar 2016 16:08:10 GMT Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u2BG890g004279; Fri, 11 Mar 2016 16:08:09 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:109542 Archived-At: > >> Is there a function with the same behaviour of `completing-read`, exce= pt > >> that it doesn't need RET when only one completion exists? >=20 > > Of course, it's called `completing-read'. > > You just have to configure its TAB key accordingly. > > I.e. rebind TAB in minibuffer-local-completion-map from > > `minibuffer-complete' to a new command which does what you want. >=20 > Oh, actually, I think I misunderstood your question and there's an even > closer answer: just provide a neither-nil neither-t value for the > `require-match' argument or `completing-read'. No, I don't think so. (completing-read "Choose: " '("a") nil 'foobar) Choose: Nothing happens. Choose: TAB Choose: a Nothing happens. Choose: a Nothing happens. Choose: a TAB Nothing happens. --- FWIW, If you use Icicles, if you set option `icicle-top-level-when-sole-completion-flag' to non-nil then completion (e.g. TAB) chooses the only match for your input. In the examples above where TAB is used, the result is the same as hitting RET: the sole match (in this case also the sole candidate) is chosen. But beware that you might not always want this behavior (which is why it is not the default behavior). If you accidentally type the wrong thing then you don't get a chance to change your mind. (Of course, that's what you've said you are after: quicker choosing.)