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 15:49:33 -0800 (PST) Message-ID: References: <46dc9263-f168-4f2e-b052-120e1184fcba@default> <0ac94945-fe1d-486f-8668-c2f34167617f@default> 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 1457740210 10426 80.91.229.3 (11 Mar 2016 23:50:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 23:50:10 +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 Sat Mar 12 00:49:58 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 1aeWod-0007Nb-UQ for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Mar 2016 00:49:56 +0100 Original-Received: from localhost ([::1]:58291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeWod-0007uG-9F for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 18:49:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeWoS-0007uA-Jl for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 18:49:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeWoN-0001xa-IB for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 18:49:44 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:38868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeWoN-0001x8-Bo for help-gnu-emacs@gnu.org; Fri, 11 Mar 2016 18:49:39 -0500 Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2BNncFL032136 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Mar 2016 23:49:38 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u2BNnbk8022291 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 11 Mar 2016 23:49:37 GMT Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u2BNnZE2013802; Fri, 11 Mar 2016 23:49:36 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: 141.146.126.69 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:109546 Archived-At: > > If you hit TAB and there is only one matching candidate, the > > OP wants that candidate to be chosen (returned). >=20 > Right, that's why I'm saying "use RET not TAB". AFAIK (s)he never needs > to use TAB in such completions, always using RET will give h(er|im) the > behavior (s)he wants (either complete, or select the sole completion). Naturally you left off the part that was significant here: There is a difference between (a) knowing that what you type is sufficient to choose a single candidate, and so you hit RET, and (b) not knowing whether there is only one match, and maybe not even knowing whether completion is lax or REQUIRE-MATCH is t, so you hit TAB. (completing-read "Choose: " '("a" "aa" "b") nil t) You type `a'. You don't know what the candidates are, but you guess that at least one begins with `a'. If you hit RET then you get the first candidate, `a'. If you hit TAB then you see that there are two matching candidates, `a' and `aa', and you can choose whichever one you want. There is NOT a sole candidate that matches your input `a' in this case. And what you said is not true in this case: "either complete, or select the sole completion." If you use `a RET' then you get `a' - you see no completions, and what you get is not the only match. RET with REQUIRE-MATCHES =3D t does not respond to what was requested, IIUC. I interpret the OP request "doesn't need RET when only one completion exists" as meaning that the OP (1) does not want to have to use two keys when only one candidate matches, but (2) s?he also wants completion - wants to see the matches when there is more than one. For vanilla Emacs, neither TAB nor RET does this - in the general case you need to hit two keys: TAB to complete and RET to choose. As I said, if you KNOW that what you type matches only one candidate then you can just hit RET - of course. But that is true regardless of the value of REQUIRE-MATCH.