From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: Imports / inclusion of s.el into Emacs Date: Tue, 5 May 2020 09:42:06 -0700 (PDT) Message-ID: <75f9c0b7-c1ea-4dfc-b326-5772afe6f64b@default> References: <0c88192c-3c33-46ed-95cb-b4c6928016e3@default> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69597"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Richard Stallman , Emacs developers , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , =?utf-8?B?7KGw7ISx67mI?= , Dmitry Gutov , Eli Zaretskii , Stefan Monnier To: Philippe Vaucher Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 05 18:44:21 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW0g7-000HuT-W6 for ged-emacs-devel@m.gmane-mx.org; Tue, 05 May 2020 18:44:20 +0200 Original-Received: from localhost ([::1]:33764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jW0g6-0004Dx-Ug for ged-emacs-devel@m.gmane-mx.org; Tue, 05 May 2020 12:44:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jW0e8-0000u7-FA for emacs-devel@gnu.org; Tue, 05 May 2020 12:42:16 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:55814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jW0e6-0005VZ-O3; Tue, 05 May 2020 12:42:15 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 045GfSx0110286; Tue, 5 May 2020 16:42:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=+v2In+ZYYPf8rEoTp7nJhS7XGcTGVSEuYY9yiXLlcAI=; b=AfoJCXqzG0Cr99eFGKLlmv6p5NoiFx5kT+CEy3dh0+AkipTow8JiC4f5zIAR9Le1d9Lv fhoT3IGcPfuup3/NGwXSLYVCkw7JtKLGPteMb3Ss/ehIjPquZHYhed/3Q0MILZYFH7CT 7ygRrGD1rUD07x3HXHpgAmFtqVjTIf6WldRA0TEloBIRQN4vbskKHBEOOEnfsbAqv2WO naQ8dnbOqSUW6GDeQB2faRhowYXtyS/nhF0kY7kblID9TPN3WHSySq1vi8zSZYeZvAbF TzCGMdeYrQlSm485WztTxRGeN58v00BEGTiXF4vcEzH0AWgkjG8CQ/OHhg4lN9P7mHtY lA== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 30s09r5x0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 16:42:09 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 045GfPhK014625; Tue, 5 May 2020 16:42:09 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 30sjnf2ucp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 16:42:09 +0000 Original-Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 045Gg7jx029050; Tue, 5 May 2020 16:42:07 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4993.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9612 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050130 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9612 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050129 Received-SPF: pass client-ip=156.151.31.86; envelope-from=drew.adams@oracle.com; helo=userp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 12:42:11 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249012 Archived-At: > > Don't forget that completion can now use substring > > and other kinds of matching. >=20 > You understand that substring completion fails as soon as the term is > too generic? e.g "string", "regexp" or "list", the list is just a lot > of noise. No, I don't "understand" that. I mean I don't agree. My position is that there is no one-size-fits-all answer wrt completion. Completion can serve many, many, many different purposes. And different matching methods offer different advantages for different purposes. I use substring matching (regexp actually, but often the pattern is, in effect, a substring) very, very often. And I can change among different match methods instantly - nothing ties me down to using substring matching, at all. The domain (search space) for any given completion is a set of completion candidates. This set is defined before you input anything. The definition can come from anything/anywhere, in any way. For completion of buffer text (e.g. code) it typically comes from text immediately before point. For a help command (e.g. `C-h f') it might come from the symbols that fit certain criteria (e.g. have a function definition). So already there is "matching" in some sense. `completing-read', for example, can define a set of candidates using a PREDICATE argument. All built-in functions that accept exactly one arg? This predicate should do that job: (defun unary-subr-p (f) (let* ((fun (symbol-function f)) (ar (and fun (ignore-errors (subr-arity fun))))) (and ar (eql 1 (car ar)) (eql 1 (cdr ar))))) (completing-read "Unary subr: " obarray 'unary-subr-p) A particular set of candidates is defined, and you can use completion just to examine that set, if you want. (There are 345 of them in my session.) And if you have an interesting completion UI you can perhaps selectively act on one or more of those candidates. You can perhaps show some info (e.g. help/definition) about specific candidates. E.g., perhaps cycling among function-name candidates shows you the first line of their doc strings in the mode-line of buffer `*Completions', one by one. Or maybe it shows you their complete doc strings in `*Help*'. Or if the candidates are file names, maybe it shows you info about the individual files as you cycle among them. Or perhaps your UI lets you act on the set as a whole in some way, e.g. print it, check out all of the files, ... whatever. This is all still without any matching of input that you provide. Completion is about using a _set_ of things (names, but behind names, things they name). Then, you can of course provide input to _match_ against those domain candidates, to narrow the field, giving a new, smaller set to play with. But you can do the same kinds of things with that new set: examine members, get info about them, maybe act on them, individually or as a set, in specific or arbitrary ways. Provide a regexp or substring pattern to match, et voila! You've got "apropos" filtering of candidate names. And if your completion UI gives you help/info about individual candidates then you get the "apropos" doc as well. Some completion UIs let you can perform general set operations: intersect the current set of matches with one or more other candidate sets, get the union of sets, complement (e.g. wrt the domain or a previous filtering or a previously saved candidates set),... And yes,...(drum roll) typically you can also just choose one element of the set, act on it in some way, and exit completion. A quick in-&-out-burger. That last action is what many people think of as completion - nothing more. And if that's their only goal then they can easily think that what's most important is always only speed of action, small number of choices, etc. IMO, that's just one small, but important, use case for completion. In sum, yes, I might want to see all of the functions with `string' in their name. And seeing them, I might want to get more info about some of them. Or act on some of them in other ways. No matter how many there are. Heck, I might even just want to see how many functions have `string' or `regexp' in their name - e.g., to consider a question about possible renamings... ;-) In my Emacs session right now, I use `C-h f', type `string' and `S-TAB', to (1) see all that have `string' as substring and (2) see that there are 459 of them. And plain `TAB' tells me there are 47 with `string' as prefix, and matching `string-' instead of `string' tells me there are 42 with that prefix (it filters out candidates `string', `string<', `string=3D', `string>', and `stringp'). In general, it's the completion _process_ that's important. And that can serve several goals. Instead of focusing on just the goal of choosing one candidate, consider the overall process: There's a set (domain) of possible candidates, which you can you filter with your input. You can do anything you want with a set of candidates or any of its members, at any point in the process. > Also it doesn't quite work when the order is > "reversed", e.g C-h f "string TAB multibyte" > would not return the desired function > because it has to be "multibyte TAB string". For orderless matching I match the 2 patterns separately. With my UI that's `string S-SPC multibyte' or `multibyte S-SPC string' - same result: all matches, any order. And of course all I really need to type are some chars from those patterns. And I can limit matches to candidates that start or end with one of those patterns, not just candidates that contain them. Is what I'm saying limited to having a UI that lets me do such non-vanilla stuff? No. With vanilla Emacs, out of the box, you can use completion to _examine_ a set of matches. That can tell you something. It's not only about choosing a candidate and acting on it in only one way. Completion is about sets. ___ https://www.emacswiki.org/emacs/Icicles_-_Nutshell_View#completionprocessan= dgoals