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: Add user customization fido-completion-styles Date: Tue, 2 Jun 2020 09:14:42 -0700 (PDT) Message-ID: <3483a8d9-1474-45cf-afad-8d276b96ef3f@default> References: <87r1uzn018.fsf@gmail.com> <953E1512-6420-4AE8-AF29-15AB151B6344@schwartzmeyer.com> <877dwpn2id.fsf@gmail.com> 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="48284"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , Andrew Schwartzmeyer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 02 18:16:02 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 1jg9a5-000CO6-8w for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 18:16:01 +0200 Original-Received: from localhost ([::1]:40066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg9a4-000185-8U for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 12:16:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg9Z0-00080P-Je for emacs-devel@gnu.org; Tue, 02 Jun 2020 12:14:54 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:49554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg9Yy-0005WU-QK for emacs-devel@gnu.org; Tue, 02 Jun 2020 12:14:53 -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 052G27FY148658; Tue, 2 Jun 2020 16:14:50 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=itbg9XymvbZlF5IqXLvs+PPVHghapSwmpIfFigJiqB4=; b=aJIp4DOYcFHVIwRIg/Nv734CEhNo0OwmM8JkS4123lpmAxzzSh4nSIGNd9EpRo2pfZMX BOSkgB98N2wejH6rSU4s+5aMg4c8eE/dzK4aGonMNSeEMoGKsWp75pmPHe9EO5l+RQAG B4ihOeQvFOoK53hsg1QWx1EcTUuHUUDnOLcS5Cxy/X9RQmeJdLhQrKX+zMvvynIoomxQ Sh+viEjcLv8qF/dRaOmLOcw23fPwLn+kNv1FDLn8wj8GeDCeDGZlR2az5cVYuxUhDhj8 65gusTgPqsHEzbhPuo0JTF11ITzBCSF4iOMKA7pwuZjQ7sgcdbcD+A6eDOnqYnW1Fpkp aA== Original-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 31bewqvypa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 02 Jun 2020 16:14:50 +0000 Original-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 052G3Q6o189031; Tue, 2 Jun 2020 16:14:49 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 31c12pfvfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Jun 2020 16:14:49 +0000 Original-Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 052GEmUe023320; Tue, 2 Jun 2020 16:14:49 GMT In-Reply-To: <877dwpn2id.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5005.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9640 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9640 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 cotscore=-2147483648 lowpriorityscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020115 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/06/02 12:14:51 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [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_H2=-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:251762 Archived-At: FWIW: If you choose the sort order "by flx score" in Icicles, and if you type no pattern to match in the minibuffer, then the candidates (e.g. commands, for `M-x') are sorted by `string-lessp' (but respecting `completion-ignore-case'). In general, the predefined sort orders in Icicles do something reasonable when the main sorting test says two candidates are incomparable. Some such orders have more than one fallback level, i.e., more than one kind of sorting, the 2nd taking over when the 1st can't compare, the 3rd taking over when the 2nd can't compare, etc. Often the (last) fallback is alphabetical order. For example, for flx-score sorting, the test predicate is this: (defun icicle-flx-score-greater-p (s1 s2) "Non-nil means the `flx-score' of S1 is greater than that of S2. That is, the cars of the `flx-score' values are compared. If `flx-score' returns nil for either argument, then they are compared using `icicle-case-string-less-p'. This function requires library `flx.el'." (let* ((input (if (and (icicle-file-name-input-p) =20 insert-default-directory) (file-name-nondirectory icicle-current-input) icicle-current-input)) (score1 (flx-score s1 input)) (score2 (flx-score s2 input))) (if (and score1 score2) (> (car score1) (car score2)) (icicle-case-string-less-p s1 s2)))) I don't know why Emacs shouldn't act similarly. As for performance, for `M-x' there certainly is no problem. `M-x' with no input pattern to match shows the 6000-some candidates immediately. https://www.emacswiki.org/emacs/Icicles_-_Sorting_Candidates ___ FWIW2: Icicles extends the idea of combining predicates in the definition of a single sort predicate, in two ways: 1. Interactively, you can apply multiple sort orders, sequentially. 2. A sort comparer can itself be defined as a list ((PRED...) FINAL-PRED), where each PRED and FINAL-PRED are binary predicates. #1 is described here: https://www.emacswiki.org/emacs/Icicles_-_Sorting_Candidates#AddingASavedSo= rtOrder In #2, each PRED returns true, false, or undecided, where undecided means that the next PRED takes over deciding, and so on. FINAL-PRED just returns true or false. (True is `(t)', false is `(nil)', and undecided is nil.) This way of combining yes-no-maybe predicates is described here: https://www.emacswiki.org/emacs/ApplesAndOranges ___ (Note: Icicles uses the flx-scoring provided by 3rd-party library `flx.el', from Le Wang (if loaded), not the flx completing style you recently added to vanilla Emacs. https://github.com/lewang/flx)