emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating *Completions* as you type


From: sbaugh
Subject: Re: Updating *Completions* as you type
Date: Tue, 21 Nov 2023 12:40:35 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

Juri Linkov <juri@linkov.net> writes:
>> I expect some disagreement about the following question: should
>> completion-category-overrides override the display-sort-function
>> returned by the completion table?  That is, should it instead be:
>>
>> (or
>>  (alist-get 'display-sort-function (alist-get category 
>> completion-category-overrides))
>>  (alist-get 'display-sort-function metadata)
>>  (alist-get 'display-sort-function (alist-get category 
>> completion-category-defaults))
>>  completions-sort)
>
> I think this is the most correct precedence since the users should be
> able to override the function call metadata.  We have an analogous
> priority levels for 'display-buffer':
>
> 1. display-buffer-overriding-action
> 2. display-buffer-alist
> 3. function call arguments that correspond to completion metadata
> 4. display-buffer-base-action
> 5. display-buffer-fallback-action
>
> Since completion-category-overrides is a user option
> it corresponds to display-buffer-alist.
> And completion-category-defaults looks like
> display-buffer-base-action.

A few points in favor of

  (alist-get 'display-sort-function metadata)
  (alist-get 'display-sort-function (alist-get category 
completion-category-overrides))

instead:

- Again, the user is still able to configure the display-sort-function
  by configuring the individual completion table.  That's not true with
  display-buffer.  The only configuration mechanism is
  display-buffer-alist.

- Given that the user can still configure the display-sort-function, I
  don't see any use case where the user should override it.  (A buggy
  completion table that returns the wrong display-sort-function?  But
  that should just be fixed.)

- display-buffer-alist is driven purely by buffer-match-p conditions, so
  there's a linear sequence of overriding.  The display-sort-function
  has two levels: the completion table and the completion category.
  Since the table is more specific than the category, it should override
  the category.

- As a minor point, I, and many other Emacs users IME, find the
  display-buffer configuration to be complex and hard to use, so I don't
  think we should try to emulate it too much.

- The "overrides" in "completion-category-overrides" is just a name.  It
  doesn't mean that we have to make it override everything else.

I suppose we could add a new completion-category-table-overrides, if we
find a use case for making the category override the table but it's
rare.  That's starting to reach the complexity of display-buffer-alist
though...

Alternatively, could we just add support for configuring the individual
table now, and add category-based configuration later?  We don't need to
add everything all at once, and that will give us valuable user
feedback.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]