all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: jporterbugs@gmail.com, me@eshelyaron.com, emacs-devel@gnu.org,
	dmitry@gutov.dev, juri@linkov.net
Subject: Re: Allowing completion sources to customize completion display
Date: Sat, 25 Nov 2023 08:59:00 +0200	[thread overview]
Message-ID: <83r0kee2tn.fsf@gnu.org> (raw)
In-Reply-To: <ier1qcfkqm5.fsf@janestreet.com> (message from Spencer Baugh on Fri, 24 Nov 2023 12:28:34 -0500)

> From: Spencer Baugh <sbaugh@janestreet.com>
> Cc: Jim Porter <jporterbugs@gmail.com>,  me@eshelyaron.com,
>  emacs-devel@gnu.org, Dmitry Gutov <dmitry@gutov.dev>, Juri Linkov
>  <juri@linkov.net>
> Date: Fri, 24 Nov 2023 12:28:34 -0500
> 
> In my example, I was considering two sources, one which returns symbols
> and one which usually returns big multi-line strings.  And I, as a user,
> wanted the default Completions buffer for the first, and inline preview
> for the second.
> 
> But basing this on the source is totally wrong.  Instead if I, as a
> user, think inline preview is better for multi-line completion
> candidates, then inline preview should be used for multi-line completion
> candidates regardless of where those candidates come from.
> 
> So I, as a user, can just configure my completion UI to detect
> multi-line completion candidates and alter the UI in that case.  No need
> to care about the sources of completion candidates.
> 
> And such configuration options would be straightforward to add to any
> completion UI, including the default completion-in-region-function.

I'm not sure I understand what you mean by "multi-line completion
candidates", but if I do, IMO we should display each supported format
of completion candidates in a way that fits that format.  IOW, there's
no reason to ask the user to configure that; we should instead provide
OOTB built-in UI for displaying candidates based on their "type".

> Now just separately speculating about what concrete options might be
> nice to add at some point to the default completion UI, to get nice
> inline preview behavior for multi-line strings...
> 
> Perhaps two options:
> 
> - completions-ghost-preview=t shows, in the buffer or minibuffer, a
>   grayed-out "ghost" preview of the currently selected completion
>   candidate.
> 
> - completions-multi-line-suppress=t makes the *Completions* buffer
>   shrink down to just show completion-header-format and
>   completion-show-help whenever there's multi-line candidates among the
>   completions.  (So you'd only have the preview from
>   completions-ghost-preview.)

If this is about preview of candidates specifically, using the
*Completions* buffer doesn't sound like a good idea to me, since
popping a buffer up and down and resizing its window as the user types
produces annoying visual effects, and also will slow down the preview,
since these operations are relatively expensive.

How about showing a multiline "ghost" instead?  Or maybe you should
produce a few examples of such multiline candidates, so that this
discussion is less academic?



  parent reply	other threads:[~2023-11-25  6:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 23:05 Allowing completion sources to customize completion display Spencer Baugh
2023-11-23  8:25 ` Eshel Yaron
2023-11-23  8:47   ` Eli Zaretskii
2023-11-23 12:38     ` sbaugh
2023-11-23 13:48       ` Eli Zaretskii
2023-11-23 14:03         ` sbaugh
2023-11-23 14:35           ` Eli Zaretskii
2023-11-23 21:20     ` Jim Porter
2023-11-24  7:15       ` Eli Zaretskii
2023-11-24 17:28         ` Spencer Baugh
2023-11-24 20:52           ` [External] : " Drew Adams
2023-11-25  0:25           ` Dmitry Gutov
2023-11-25 17:36             ` sbaugh
2023-11-25 18:27               ` Dmitry Gutov
2023-11-25 19:07                 ` Eli Zaretskii
2023-11-25 19:08                   ` Dmitry Gutov
2023-11-25 20:04                     ` Eli Zaretskii
2023-11-25  6:59           ` Eli Zaretskii [this message]
2023-11-23 14:44 ` Dmitry Gutov

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

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

  git send-email \
    --in-reply-to=83r0kee2tn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=emacs-devel@gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=juri@linkov.net \
    --cc=me@eshelyaron.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.