unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 70217@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#70217: [PATCH] Add substring-partial-completion style
Date: Fri, 17 May 2024 00:09:54 +0200	[thread overview]
Message-ID: <87o795pfwt.fsf@daniel-mendler.de> (raw)
In-Reply-To: <ierv83dtsef.fsf@janestreet.com> (Spencer Baugh's message of "Thu, 16 May 2024 16:26:32 -0400")

Spencer Baugh <sbaugh@janestreet.com> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> 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





  reply	other threads:[~2024-05-16 22:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 12:41 bug#70217: [PATCH] Add substring-partial-completion style Spencer Baugh
2024-04-05 18:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-05 19:46   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-06  8:10     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-18 15:19   ` Spencer Baugh
2024-05-08 16:46     ` Spencer Baugh
2024-05-08 17:14       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-16 20:26         ` Spencer Baugh
2024-05-16 22:09           ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-05-17  6:23           ` Eli Zaretskii
2024-05-25 21:22             ` Spencer Baugh
2024-05-26  7:56               ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-26 12:49                 ` Spencer Baugh
2024-05-26  9:11               ` Eli Zaretskii
2024-05-26 13:02                 ` Spencer Baugh
2024-05-26 15:51                   ` Eli Zaretskii
2024-05-28 14:39                     ` Spencer Baugh
2024-05-28 15:11                       ` Eli Zaretskii
2024-05-28 18:16                         ` Spencer Baugh
2024-05-28 18:36                           ` Eli Zaretskii
2024-05-28 18:51                             ` Spencer Baugh
2024-05-28 19:21                               ` Eli Zaretskii
2024-05-28 20:01                                 ` Spencer Baugh
2024-06-01 14:20                                   ` Eli Zaretskii
2024-06-02 12:16                                     ` Spencer Baugh
2024-06-02 14:34                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-08 13:13                                         ` Spencer Baugh
2024-08-10  8:02                                           ` Eli Zaretskii
2024-08-21 16:01                                             ` Spencer Baugh
2024-08-21 16:16                                               ` Spencer Baugh
2024-08-24  9:23                                                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o795pfwt.fsf@daniel-mendler.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70217@debbugs.gnu.org \
    --cc=mail@daniel-mendler.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).