From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#70217: [PATCH] Add substring-partial-completion style Date: Thu, 18 Apr 2024 11:19:04 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12764"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70217@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 18 17:20:09 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 1rxTYX-00035J-51 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Apr 2024 17:20:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxTYH-00034X-B9; Thu, 18 Apr 2024 11:19:53 -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 1rxTYE-00034K-0F for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:19:50 -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 1rxTYC-0004AN-SN for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:19:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxTYQ-0006x0-DF for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Apr 2024 15:20: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.171345356726508 (code B ref 70217); Thu, 18 Apr 2024 15:20:02 +0000 Original-Received: (at 70217) by debbugs.gnu.org; 18 Apr 2024 15:19:27 +0000 Original-Received: from localhost ([127.0.0.1]:52993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxTXq-0006tQ-I0 for submit@debbugs.gnu.org; Thu, 18 Apr 2024 11:19:27 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:57477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxTXn-0006sY-S5 for 70217@debbugs.gnu.org; Thu, 18 Apr 2024 11:19:25 -0400 In-Reply-To: (Stefan Monnier's message of "Fri, 05 Apr 2024 14:35:24 -0400") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1713453544; bh=RMB++O/K3kyB4o1E3dpka0hSesKt3DTSS0/D6OVKycw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=fzQNrY2+wLhhjXhvYfhtMON+vlr6Ya5HAXlTZMKeqYbqzzwGipnw8cB4ksinCxPo1 8VcKGQeoK/WIE2adPUmgh9qeOin4siTvD6CeXuGNIRE6z5cVUos5xiqDR/7OjIwY+1 zKjOq7xS7Zh6kna1ytM2UTMAlnh+7c0Fzjmot81lgjcfUjPijiyUmJIvKBqbfb6SIt J1kTfxkWCYX0brc+fETLeQUAo2Jpr5DhDHGVPcHi/qFgUTRWA7UewnIXP9H0ZTCsIX D3gMCrMcd5mberEOyE1TdTKk2BhPrycnWGyD7yF2KRLJCqCQ9r31wS3CAHKUCdoVYu 952iHQLPXWf1g== 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:283571 Archived-At: Stefan Monnier writes: >> It's preferable for this to be a separate style from partial-completion >> rather than a customization for partial-completion, because completing >> with a leading glob is inefficient: it doesn't allow the completion >> table to do any filtering at all. So, for example, one might want the >> regular partial-completion style to run first, and if it doesn't find >> anything then the substring-partial-completion style can run. > > FWIW, I think the "language of completion styles" would benefit from > being a bit richer. I.e. instead of a completion style (i.e. an entry > in `completion-styles`) being limited to a symbol, we could > extend it so a style can take arguments. > > E.g. the `substring` style could take an argument which when set to the > symbol `pcm` would cause it to behave like your "substring-partial-completion": > > (setq completion-styles '(basic (substring pcm) emacs22)) > > Alternatively, it could be an argument to `partial-completion`, e.g.: > > (setq completion-styles '(basic (partial-completion notanchored) emacs22)) This is a good point, because I think there's a few things I want which fit neatly with this: - '(substring pcm) (i.e. the behavior added in this feature) - '(emacs22 pcm) (i.e. ignoring the suffix after point, but using pcm for what's before point) - '(emacs22 pcm substring) (i.e. ignoring the suffix after point, but also globbing at the start of the completion like substring, and using pcm for it) But, also, I realized that I basically always want PCM for both the substring and emacs22 completion styles. So what about having two customizations, defaulting to nil? completion-substring-use-pcm completion-emacs22-use-pcm These customization will affect all usage of those styles. Without this approach, I'd have to use completion-category-overrides to override the completion styles for every single category, just to make the styles use PCM. (which IMO should be the default anyway) This doesn't give me the substring-emacs22 style that I want, but maybe that should actually be a separate style, since its behavior would be fairly different from both emacs22 and substring, and so probably doesn't make sense as an option.