unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: help-gnu-emacs@gnu.org
Subject: Teach completion to insert a common prefix
Date: Mon, 07 Aug 2023 16:38:55 -0400	[thread overview]
Message-ID: <ier7cq6610g.fsf@janestreet.com> (raw)


Example in emacs -Q:

C-h v -matching-lines- TAB

All possible completions for -matching-lines- start with
list-matching-lines-.  So there would be no harm in inserting "list" at
the start of the completion input.  But Emacs does not do this.

Is it possible to teach Emacs completion to insert a common prefix if
there is one, like in this situation?

Two reasons:

- It would look nicer

- It would make completion work better if the desired completion
alternative is itself a prefix of some other alternative.  For example,
if both list-matching-lines-buffer and list-matching-lines-buffer-face
are available completion alternatives, then it is hard to use completion
to input list-matching-lines-buffer, since it only completes to
-matching-lines-buffer which is not an actual alternative.

This is *not* a matter of completion-styles, variable completion already
uses the substring completion style, otherwise -matching-lines- wouldn't
even validly complete to list-matching-lines-something.

This is purely a matter of teaching completion to eagerly insert the
common prefix when there is one.

Is this possible?




             reply	other threads:[~2023-08-07 20:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 20:38 Spencer Baugh [this message]
2023-08-08  6:19 ` Teach completion to insert a common prefix Yuri Khan
2023-08-09  4:09   ` Pierre Rouleau
2023-08-10 11:33     ` sbaugh

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=ier7cq6610g.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).