From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70217: [PATCH] Add substring-partial-completion style Date: Fri, 17 May 2024 00:09:54 +0200 Message-ID: <87o795pfwt.fsf@daniel-mendler.de> References: Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28867"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70217@debbugs.gnu.org, Stefan Monnier To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 17 00:13:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1s7jLe-0007M9-Py for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 May 2024 00:13:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7jLT-0000vG-BM; Thu, 16 May 2024 18:13:03 -0400 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 1s7jLQ-0000uQ-24 for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 18:13:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7jLP-0001FE-PU for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 18:12:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7jLS-00051T-7T for bug-gnu-emacs@gnu.org; Thu, 16 May 2024 18:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2024 22:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70217 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70217-submit@debbugs.gnu.org id=B70217.171589754419285 (code B ref 70217); Thu, 16 May 2024 22:13:02 +0000 Original-Received: (at 70217) by debbugs.gnu.org; 16 May 2024 22:12:24 +0000 Original-Received: from localhost ([127.0.0.1]:51299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7jKp-00050z-Q1 for submit@debbugs.gnu.org; Thu, 16 May 2024 18:12:24 -0400 Original-Received: from server.qxqx.de ([49.12.34.165]:40983 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7jKh-00050r-F8 for 70217@debbugs.gnu.org; Thu, 16 May 2024 18:12:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tZHvVlmv5rdZcbKziWiwmMJd0YuYPxiRuvbfgYT9LsE=; b=BpOzRb0nS3n2kusbhOjKdzYUPI nNa5cE7hqBL/C0k/MXzD0yToTMfvzWgIqO+k/60mHh2XQlY/Exq7j3RQ2slteDyrmidxxDhui1YcF qcgMVmKrltmYCDAG2Ona9TGbS3PLl1trguDEkhWK6T/YS7z36JoiBhZkPcibwTj18GkQ=; In-Reply-To: (Spencer Baugh's message of "Thu, 16 May 2024 16:26:32 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285208 Archived-At: Spencer Baugh writes: > Stefan Monnier writes: > >>> * lisp/minibuffer.el (completion-emacs22-use-pcm) >>> (completion-substring-use-pcm): Add. (bug#70217) >>> (completion-emacs22-try-completion) >>> (completion-emacs22-all-completions): Check completion-emacs22-use-pcm. >>> (completion-pcm--string->pattern, completion-pcm--find-all-completions) >>> (completion-pcm-all-completions, completion-pcm--merge-try) >>> (completion-pcm-try-completion): Add "startglob" optional argument and >>> pass through. >>> (completion-substring-try-completion) >>> (completion-substring-all-completions): Check >>> completion-substring-use-pcm and pass startglob=t. >> >> I'm not super happy about this `startglob` everywhere. >> Two things bother me about it: >> >> - Its name and doc (in my view of what "glob" means, there's no such >> thing as a "leading glob"; I think you're talking about a leading >> wildcard (which is one of the things that can appear in a glob >> pattern)). > > Yes, very true, changed to "anchored". > >> - Its spreading all over the place. > > In the attached diff it's a dynamic variable completion-pcm-anchored > checked in one place. How's that? > >> I don't have the time to dig into the second problem (which might be >> fixable by combining this info into the `string` argument (which >> wouldn't be just a string as more, so it could have too-far reaching >> consequences)), but for the first I suspect a "standard" name for this >> idea is `anchored`. >> >> Other than that, I don't have a strong opinion on whether to introduce >> the feature via new styles or as custom vars that affect >> existing styles. Either way works for me. > > As part of making it a dynamic variable, I also changed the usage. In > the attached diff, an element in completion-styles can contain > additional dynamic variable bindings: > > (setq completion-styles '(basic (partial-completion (completion-pcm-anchored nil)) emacs22)) > > This is powerful and elegant in some ways - for example now a user could > use completion-ignore-case only for an individual style. Also, the > overall diff is now much shorter. This sounds great. It will also be useful in other settings. For example the Orderless completion style can be configured via a bunch of dynamic variables. Right now, in orderless.el we provide the helper macro `orderless-define-completion-style' which creates a derived completion style with a bunch of let-bound dynamic variables. Your new feature will make it easier and more direct to configure custom derived completion styles. Daniel