From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Add user customization fido-completion-styles Date: Tue, 02 Jun 2020 18:47:01 +0200 Message-ID: <87h7vtfm9m.fsf@gnu.org> References: <87r1uzn018.fsf@gmail.com> <87lfl5fpbx.fsf@gnu.org> 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="65781"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 02 18:49:20 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 1jgA6J-000GzR-RX for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 18:49:19 +0200 Original-Received: from localhost ([::1]:56948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgA6I-0007YU-SZ for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jun 2020 12:49:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgA5i-00074s-QU for emacs-devel@gnu.org; Tue, 02 Jun 2020 12:48:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48070) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgA5i-0005L8-9p; Tue, 02 Jun 2020 12:48:42 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:47377) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1jgA5h-0001uj-5I; Tue, 02 Jun 2020 12:48:42 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id C2DBE27C0054; Tue, 2 Jun 2020 12:48:40 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 02 Jun 2020 12:48:40 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudefjedgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufhfffgjkfgfgggtgfesthhqredttderjeenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe dvueefkeeuleekheffffdtieduvdfhffdtgfekhfejueejudehudekveefvedvhfenucfk phepgeeirdektddrjeehrddvfeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghl ihhthidqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfh grshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from thinkpad-t440p (p2e504bea.dip0.t-ipconnect.de [46.80.75.234]) by mail.messagingengine.com (Postfix) with ESMTPA id A0710328005E; Tue, 2 Jun 2020 12:47:53 -0400 (EDT) Mail-Followup-To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , Andrew Schwartzmeyer , emacs-devel In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vora=22's?= message of "Tue, 2 Jun 2020 16:55:45 +0100") 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:251763 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > On Tue, Jun 2, 2020 at 4:40 PM Tassilo Horn wrote: > >> > (add-hook 'icomplete-minibuffer-setup-hook 'my-flex-styles) >> > (defun my-flex-styles () (setq-local completion-styles '(initials > flex))) >> > >> > Or just use a lambda, which is even shorter. I'd like to avoid a >> > duplicate version of completion-styles customization vars. >> >> I guess fido-mode sets `completion-styles' locally in order to achieve >> ido-like defaults, right? > > Yes, exactly. fido-mode is broadly "choose these nice icomplete-mode > settings that make it fake ido-mode". > >> But as a user with customized `completion-styles' and >> `completion-category-overrides', I wish there was a simple way to >> just use them with fido, too. > > You can try icomplete-mode directly if you don't like fido-mode's. > fido-mode is a small customization layer on top of it that makes some > choices for you. Yes, I know. And except for the change in completion-styles, I like it. Not so much for plain icomplete-mode where the fido keybindings are missing. >> Especially, I can't see how I could figure out the right category >> override. Is the completion metadata accessible in >> icomplete-minibuffer-setup-hook? > > I don't know what you mean. Exactly what are you trying do to? > Anyway, I'm reasonably confident you can set > completion-category-overrides there. If I understand the docs correctly, `completion-category-overrides' override the normal `completion-styles' on a category basis. I have these customizations: --8<---------------cut here---------------start------------->8--- (setq completion-styles '(basic partial-completion substring flex) completion-category-overrides '((ecomplete (styles basic partial-completion substring)) (buffer (styles basic partial-completion substring)) (unicode-name (styles basic partial-completion flex)) (info-menu (styles basic partial-completion flex)) (project-file (styles basic partial-completion substring initials)) (file (styles basic partial-completion substring initials)) ;; TODO: There's actually no command category (yet). (command (styles basic partial-completion substring initials)))) --8<---------------cut here---------------end--------------->8--- So when completing buffers, completion-styles will be (basic partial-completion substring) whereas when completing files it'll be (basic partial-completion substring initials) and when not completing something in the overrides, it'll go with the normal customized completion-styles of (basic partial-completion substring flex). I don't know when this happens, but it might be that it is before `icomplete-minibuffer-setup-hook' is called and then setting `completion-category-overrides' wouldn't have an effect. I'll test... Thanks, Tassilo