From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: Possible minibuffer completion enhancements Date: Mon, 22 Jan 2024 13:18:01 +0100 Message-ID: References: <86v87l4xii.fsf@mail.linkov.net> <87a5ox7png.fsf@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20087"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Juri Linkov , Stefan Kangas , emacs-devel@gnu.org To: Daniel Mendler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 22 13:19:10 2024 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 1rRtGf-00051q-Bp for ged-emacs-devel@m.gmane-mx.org; Mon, 22 Jan 2024 13:19:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRtFh-0006bC-Bg; Mon, 22 Jan 2024 07:18:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRtFf-0006ZJ-ND for emacs-devel@gnu.org; Mon, 22 Jan 2024 07:18:07 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRtFd-0007Hu-PC for emacs-devel@gnu.org; Mon, 22 Jan 2024 07:18:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1705925884; bh=bFiDlRNsesy5Ysc6rX+VjSpfO49SVFvehnycA+tMe+E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=g8CilEidelWQYbTmTOKSIqwmBL6DzIzFDN7M3K3J/8whXPtiwDC0Nm1tBkZ7fqUK2 tmvfbxtt+3Iv8qbBw02CTU5pGACMD/MAAoyzaeDgAavUv4r1LDfRwm3dEi962LvfS+ cRTCT2Wp8P4A6z2e1oNOlPzZSqlpPtnQwigLBgMhYWA/hEFqdUoAID/75XTHhyLnbO 0ICfrNCLiPsOLZDS1jjhKwsN4qrU8grhscT1HvGctuuT2nIaCLVfsDFGLG/PnYepjA 6p5rgRxbiUy5/BotUWB7BKyc4eiWZLDcgNAVkLvKc9SYg0r+hsit79qYmIHISDHKCc yNJpraQ7PPDXg== In-Reply-To: <87a5ox7png.fsf@daniel-mendler.de> (Daniel Mendler's message of "Mon, 22 Jan 2024 09:12:19 +0100") Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315211 Archived-At: Daniel Mendler writes: > Juri Linkov writes: > >>> I've rebased the feature/minibuffer-completion-enhancements branch on >>> top of the current master, and pushed it to emacs.git. Looking forward >>> for your thoughts and feedback! >> >> Thanks, I tried 'C-x C-v' (minibuffer-sort-completions), >> and it works nicely. Great, thanks Juri! >> But I can't imagine how the whole branch could be merged to master >> when it contains so diverse set of different features. > > I agree. I suggest to create a set of separate patches, e.g., as > follows: > > 1. Helper functions, e.g., completion-table-with-metadata > 2. CRM refactoring > 3. Cycle commands for sorting > 4. Cycle commands for completion styles > 5. Annotation functions > 6. Narrowing commands I'm not sure I understand the use of the word "Cycle" in (3) and (4). My changes provide new commands that pertain to cycling (`C-o`, `C-l`), and other commands for sorting (`C-x C-v`) and setting completion styles (`C-x /`) which are not necessarily related to cycling. Did you mean to include "Cycle commands" as a separate bullet, perhaps? Regarding breaking up the changes into multiple patches, I'm definitely not opposed, but as I mentioned in another reply, it requires some effort to do that cleanly. Would any of you be willing to lend a hand with that endeavor? I'd be happy to coordinate, could be a good opportunity to discuss some of this stuff in more detail as well. > Regarding 5 and 6 it would be great to explore an alternative approach > with a :property-function because of the additional flexibility and > extensibility. We would get a lot of functionality for free. I think such an approach can leverage the infrastructure that my branch implements, for example with a `narrow-completions-function` that uses the properties you get from such a `property-function`, no? Also, I agree that the approach you brought up could provide a lot of functionality, but how would it be more flexible than the proposed `narrow-completions-function` mechanism, where the completion table can provide an arbitrary function? > Iirc Stefan Monnier had plans to change the implementation of the > completion machinery, rebasing it on a cl-defgeneric mechanism, where > completion tables provide cl-defmethods. If more and more additional > completion candidate metadata is supplied, looking into this again may > be worthwhile. > >> For example, probably everyone would agree that >> 'completion-table-with-metadata' could be installed >> in master immediately (if you present a separate patch). >> But other feature might require more discussion. > > Indeed. However the implementation of completion-table-with-metadata > I've seen in Eshel's branch did not seem correct. The function should be > simpler: Hmm, define "correct" and "should" :) My implementation is indeed more sophisticated, since it does more. In particular, it lets you override some metadata while preserving other metadata that come from the original table. Could you elaborate about how this simplified version is preferable in your opinion? > (defun completion-table-with-metadata (table metadata) > (lambda (str pred action) > (if (eq action 'metadata) > `(metadata ,@metadata > ,@(and (functionp table) > (cdr (funcall table str pred action)))) > (complete-with-action action table str pred)))) Cheers, Eshel