From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Add user customization fido-completion-styles Date: Tue, 02 Jun 2020 12:14:18 +0100 Message-ID: <877dwpn2id.fsf@gmail.com> References: <87r1uzn018.fsf@gmail.com> <953E1512-6420-4AE8-AF29-15AB151B6344@schwartzmeyer.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="2973"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: emacs-devel@gnu.org To: Andrew Schwartzmeyer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 02 13:14:56 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 1jg4sh-0000fW-Ii for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 13:14:55 +0200 Original-Received: from localhost ([::1]:48072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg4sg-0006qA-J1 for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 07:14:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg4sE-0006Ou-6m for emacs-devel@gnu.org; Tue, 02 Jun 2020 07:14:26 -0400 Original-Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:44540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jg4sB-0000p5-Pj for emacs-devel@gnu.org; Tue, 02 Jun 2020 07:14:25 -0400 Original-Received: by mail-wr1-x42f.google.com with SMTP id y17so2943024wrn.11 for ; Tue, 02 Jun 2020 04:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=rmydD4GxN8U1KCsJ7w7kWtZAMKhd92Ea3R20FbPAXUw=; b=GO1gG/fmMJmV29b1RrD5MQI1VoB/hX2TT1IX4CLgO5jhefjdiZ4Ok6z5ISwZwi/UNG Wacg6NJRdbIMgkG1f18cji56iHYkf6My1sbsw9FpCCG1N5wCnbl/JV2b8SCPg9PgGfnc fum0B9/mE5IalsXlp6/eMYqaWHLJ7E+kYQQQeOAQjPYFXFh6r+up8NbNX4DpVC/JNEy1 7oQKbkVcRKY0ZZz2oV147linBfxQ7zl/PFBhchdM/WmXteJhKSkm9ni7FpzXIGEX+T6Z PqaQg/dWqWy0vnUUJ/tDy5dl6NvtiLBlzmTOJQdxU1qs1yXukiPWWWGNacNI75c18qDZ hhiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=rmydD4GxN8U1KCsJ7w7kWtZAMKhd92Ea3R20FbPAXUw=; b=YRyQcGBWh5Lgnuj84pYiXN3iztujW9X3U0s8iywAXVCL+NzcdcjsUqdIuX95o1e4ir hVn5RqIPrk7cXIL7Sis2FXoRcRX3wchRnIobsARMT4fOT528rIJkomttMg72uLwdVtTj X+wCK0Mg/p6VJrO24g4LPNuWiV0CFytftoG+MsECKzVC85kYTC2v9AyDrO8syNegFayb niY4Fe5DSZsX3YAEiGd0BIkAQnw4C211mnA4H5Dl/BveXN0YfR7Uu7/MXFRlY45lESZj TWYL2/7eOPXel7056y154k5oaOJ70fOFbx+yw9D811bm+gfKc8hS5G0sIxBx8AEfoc+/ zoFw== X-Gm-Message-State: AOAM533/N8Uh8PuRNBMuPQ5Kt4I0VSC77l/HLtG5T/wNQMXYbgRlsWyS JFu15RvYWreBCjF58oNSBMAWUxFDE1s= X-Google-Smtp-Source: ABdhPJw6fR2hKXb0m29ZyCYaK3eOqr4TwBDqHXErIaceqYFYsDaVosZnevrcoI8gpQ5p3nd/XMqwUQ== X-Received: by 2002:a5d:45c2:: with SMTP id b2mr24648499wrs.323.1591096461462; Tue, 02 Jun 2020 04:14:21 -0700 (PDT) Original-Received: from krug ([2001:818:d820:9500:824a:171:15a:2213]) by smtp.gmail.com with ESMTPSA id e5sm3377683wrw.19.2020.06.02.04.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 04:14:20 -0700 (PDT) In-Reply-To: <953E1512-6420-4AE8-AF29-15AB151B6344@schwartzmeyer.com> (Andrew Schwartzmeyer's message of "Sun, 31 May 2020 21:37:23 -0700") Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x42f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, RCVD_IN_DNSWL_NONE=-0.0001, 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:251753 Archived-At: Andrew Schwartzmeyer writes: > With just =E2=80=9Cflex=E2=80=9D as the completion style, for some reason= M-x with no > input (from an emacs -q) presents the following candidates as the > first: > > icomplete-fido-delete-char > enable-theme > url-setup-privacy-info > dired-at-point > tab-bar-select-tab With no inputs to the flex completion style, it matches every candidate. > I can=E2=80=99t see a pattern in these. If I then call a command, I=E2=80= =99d > want/expect (from experience with other completion frameworks) the > next use of M-x to show it as the first candidate, but it doesn=E2=80=99t. fido-mode (and I believe icomplete-mode, whereupon fido-mode is based) do this for minibuffer-reading commands that have a "default", i.e. a result that is returned immediately if the user "forces" the completion with no input, regardless of whether the candidates are showing or not. M-x, which maps to execute-extended-command, is not one of those commands. Regarding the pattern, there is none. I believe that's the order of all symbols as returned by the all-completions when called to return a list of everything that is a command. It doesn't waste any time sorting. > Now if I use the aforementioned Orderless package and the minibuffer > hook to use it as the completion style in fido, somehow it does some > magic such that M-x (which is still bound to execute-extended-command) > now has some history sorting! (Working for switch-to-buffer too. :) You could do some sorting, but that is a a O(NlogN) operation (I think, may be wrong, N is the number of commands times the number of elements in the history). It doesn't make much sense to invest in this sorting because it is only useful if all the candidates have the same flex score. Which they do in the beginning situation, but that quickly changes as the user inputs a pattern. Alternatively, a dirty hack might be to exceptionally use the history list itself -- and not all the candidates -- when the pattern is empty. That'd probably fill in the space and wouldn't be functionally wrong. > So yeah, I=E2=80=99m off to look through Orderless to see what magic it d= oes > that sorts the candidates for M-x (without having do anything like > what smex does!). I haven't looked at Orderless yet. For the empty pattern case, it might be taking the shortcut I suggested. But for non-empty patterns iss it doing what I think it is doing? Will typing the three letter pattern "foo" match "foobarbaz" "fabrobazo" and "orzobafab"? In which order will they be returned? Jo=C3=A3o