From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Jules Tamagnan <jtamagnan@gmail.com>
Cc: 71716@debbugs.gnu.org
Subject: bug#71716: [PATCH] Add new completion-preview-insert-{word, sexp} commands
Date: Sat, 22 Jun 2024 16:05:05 +0200 [thread overview]
Message-ID: <m1zfrdxecu.fsf@dazzs-mbp.home> (raw)
In-Reply-To: <87a5jd8hqh.fsf@gmail.com> (Jules Tamagnan's message of "Sat, 22 Jun 2024 02:11:18 -0700")
Hi Jules,
Jules Tamagnan <jtamagnan@gmail.com> writes:
> Tags: patch
Thanks for the feature request and for the patch.
> * Problem
>
> Oftentimes when completing a value a user wants a small part of a
> completion but not the entire thing. This happens frequently when
> iterating on shell commands or on similar lines of
> code. completion-preview can help with this by quickly suggesting a
> sensible completion pulled from any completion-at-point function. The
> problem is that accepting a full completion is often inefficient because
> one might only want the first part of that completion. This leads to a
> lot of deletions after the fact.
>
> * Solution
>
> Allow inserting of partial completions when using
> completion-preview.
We currently have completion-preview-complete (M-i) for that: it inserts
the common part (prefix) of all completion candidates.
> For this I've added two new commands completion-preview-insert-word
> and completion-preview-insert-sexp which will insert the next word or
> sexp in the completion.
That sounds interesting. The ELPA package capf-autosuggest.el provided
a similar feature, IIRC. I'd like to get a better understanding of the
use case though: when would you use one of these commands instead of
completion-preview-complete?
> For consistency with completion-preview-insert I've refactored the
> code so that these three commands share a common code path.
Good idea, but there are two issues with the current implementation:
1. AFAICT, unlike completion-preview-insert, these new commands should
preserve (the rest of) the completion preview. So instead of
dismissing the preview by disabling completion-preview-active-mode
and then relying on the subsequent post-command-hook to recreate the
preview, I think these commands should modify (e.g. remove a word
from the start of) the after-string property of the preview overlay,
and inhibit a subsequent update of the preview, like we do in
completion-preview-complete. That way we avoid recomputing the
completion candidates, which may lead to a flicker in this case.
2. The temporary buffer where the motion command is executed has a
different major mode than the original buffer, so they might have
different notions of words/sexps.
> * Notes
>
> - I've added new tests for this and ensured that previous ones continue
> to pass.
> - I've signed the copyright assignments and have contributed to emacs
> previously.
That's great, thanks.
Eshel
next prev parent reply other threads:[~2024-06-22 14:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 9:11 bug#71716: [PATCH] Add new completion-preview-insert-{word, sexp} commands Jules Tamagnan
2024-06-22 14:05 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-06-22 18:58 ` Jules Tamagnan
2024-06-22 22:00 ` Jules Tamagnan
2024-06-23 8:00 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-23 22:08 ` Jules Tamagnan
2024-06-24 0:45 ` Jules Tamagnan
2024-06-24 11:49 ` Eli Zaretskii
2024-06-24 18:11 ` Jules Tamagnan
2024-06-24 12:43 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-24 17:16 ` Jules Tamagnan
2024-06-26 11:41 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-28 5:49 ` Jules Tamagnan
2024-06-28 15:00 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-27 6:33 ` Juri Linkov
2024-06-27 18:31 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=m1zfrdxecu.fsf@dazzs-mbp.home \
--to=bug-gnu-emacs@gnu.org \
--cc=71716@debbugs.gnu.org \
--cc=jtamagnan@gmail.com \
--cc=me@eshelyaron.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).