From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata Date: Sun, 25 Apr 2021 22:35:00 +0300 Message-ID: <39c93100-a352-538d-717a-663bcc5de296@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25453"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Cc: Gregory Heytings , Stefan Monnier To: Daniel Mendler , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 25 21:36:54 2021 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 1lakYo-0006Xt-6B for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Apr 2021 21:36:54 +0200 Original-Received: from localhost ([::1]:33984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lakYn-0000zU-65 for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Apr 2021 15:36:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lakX4-0000S8-EQ for emacs-devel@gnu.org; Sun, 25 Apr 2021 15:35:06 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:42918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lakX2-0002bS-II for emacs-devel@gnu.org; Sun, 25 Apr 2021 15:35:05 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id l2so1217874wrm.9 for ; Sun, 25 Apr 2021 12:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6E9GouWjMaSjirjcCIqft4q1JToRR9O/5lCmKvUTRnQ=; b=XdNnQq+hJ7e7HyCBeyJmS/hMJAbRwQonNkBdSwx8dNrMNXENZ5k8i0nuyF5iBwfCJu Yups0Bx4Nywt0EOT44fOqQeHoNBpFdVk+rTZwTcMClEbi031lcEIXAcIjaZw+VA+ArDH PAc1rHbK+/Ic6MAFqvG7PlRD/nvIQCukVSlk7kUrVE8tYXEFhUvtbjY+921RRekjQT9n zII22Pgd4rz9iFfh9Tcz5IqgX5OGFAHAl2rQCRlTSm0o74mgqG4iU8BuYT/1245mFYCr +hXJ3MFDRykW345x7vsGaKtpQTpMwYHmZQUihyT6iZ7BAXX9Br1ty190po9ZWZZGd4Bc drYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6E9GouWjMaSjirjcCIqft4q1JToRR9O/5lCmKvUTRnQ=; b=ttnXVwv4bI40NiDpeSkEqVieAd8c/oV5DKBXVlTbA4FFhOTaMsCg67or5VHCFU/Vxa izyMnBfqMsTXPEf9hlms8ZoQR1/qfZxHHD8O0IlrSEjdxKDRsMlT8uZnV4uJYGoe/pdc OxD79z1ZqspIuLTV4OqnwsCxkrGWGXMu76/zIZGQEM0aJ2PogUGhSoidBu8oCdczKr0o 1aKP3UyeJo+HPdyUIzpoXy/nQf50vqEVJg0RK4VXqCxrkJXP6dDW9jib2kuPmmey2qV/ 4JcEHJUJ4/DTiIkEqdUryZgA5LdbBX0QBGTELiAwuO+LiahzACasU9QOt5QTCZ3KGJF5 XNkg== X-Gm-Message-State: AOAM532obwa2ZqzvZFCQys6mndYjKmJELR7dPf5BbJJDxt6gP8ZU+srE IdVsuca/PPMKNffz5myMszY= X-Google-Smtp-Source: ABdhPJwwPXS2ywx3DAFt3jhOxgVv2yk/uQvG1SyDE/nbVK4dl1fyBkczjIJKD1hOLHLkohP/n6pP0w== X-Received: by 2002:a5d:52c5:: with SMTP id r5mr18333845wrv.391.1619379302700; Sun, 25 Apr 2021 12:35:02 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id e18sm17920541wrc.85.2021.04.25.12.35.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Apr 2021 12:35:02 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=raaahh@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no 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:268414 Archived-At: On 25.04.2021 16:32, Daniel Mendler wrote: > I attached a patch which adds grouping support to the completions > buffer. The completion table can specify a `group-function` via its > completion metadata. > > Currently groups are only displayed in the *Completions* buffer if > `completions-format=one-column`. My proposal is to split up the function > `completion--insert-strings` into three functions > `completion--insert-strings-one-column/vertical/horizontal` in a > follow-up patch. Then the grouping display can also be implemented for > the other display formats. > > Group title support is already present in the Vertico, Selectrum and > external Icomplete-vertical UI. Similarly we can add support to the > recently added `icomplete-vertical-mode` by Gregory. > > There is a patch to `xref.el` included, which makes use of the grouping > functionality, when the `completing-read` show function is used: > > (setq xref-show-xrefs-function #'xref-show-definitions-completing-read) The result looks nice (when enabled), though this function still doesn't work very well with the default completing read. So whether this feature works okay will depend on the alternative UI used. I wonder if there can be other examples of group-function usage added which work okay with the default completion UI. Speaking of group-function's implementation there, the text-properties approach seems like an overkill since we can reliably string-match anyway. But it's a minor thing. Another minor issue is that the docstring still says "Return title of candidate" rather than "group title" or "group name". Not going to comment on the changes to minibuffer.el, at least for now.