all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eshel Yaron <me@eshelyaron.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Word completion in text modes
Date: Sat, 18 Nov 2023 16:53:28 +0100	[thread overview]
Message-ID: <m1a5rbukg7.fsf@dazzs-mbp.home> (raw)
In-Reply-To: <83edgnmaqw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Nov 2023 15:50:15 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> It _is_ bound to `C-M-i` in `text-mode`, that's actually even mentioned
>> in several places in the Emacs manual, e.g. in "(emacs) Text Mode":
>>
>>     Text mode binds ‘M-<TAB>’ to ‘ispell-complete-word’.
>
> I tried that in mail-mode and didn't see it bound.  But that's because
> mail-mode binds C-M-i to another command.  Which IMO is a sign of a
> problem we need to fix: it makes no sense to have a completion command
> bound in Text mode but not in _all_ of its descendants.

Yes, `C-M-i` is bound to `completion-at-point` in `mail-mode-map`, which
is exactly the binding I'm proposing for the parent, `text-mode`, no?

> I guess the developers of mail-mode didn't consider
> ispell-complete-word an important enough feature, and the question
> then becomes: will the new text-mode completion-at-point feature be
> significantly better?
>
> In any case, back to the original issue: what you say about rebinding
> ispell-complete-word can only be a problem if the new completion is
> incompatible with ispell-complete-word.  So we should make sure it is
> NOT incompatible.  Then the problem would not exist.

The way I see it `ispell-complete-word` predates `completion-at-point`,
and in terms of functionality the latter subsumes the former.
`ispell-complete-word` reuses the spell correction UI of `ispell-word`
for word completion.  That's something that I wouldn't necessarily try
to port over to `completion-at-point` for compatibility sake, as we now
have various proper completion (not spell correction) interfaces that
were not available when `ispell-complete-word` came about.  Either way
it'd be compatible in the sense that you get the same completions, and
`ispell-complete-word` wouldn't go anywhere so users could rebind it if
they really want to.

>> > IMNSHO, such a feature would be much more important and useful than
>> > the minor changes of UI and reshuffling of the implementation details
>> > of the sort that you propose.
>>
>> My proposal would benefit this aim as well, I think, as we could simply
>> add another completion function to `completion-at-point-functions`, say
>> `phrase-completion-at-point`, and users would have their word completion
>> extended to include such phrase completion with no further setup.
>
> I appreciate the enthusiasm, but very much doubt that minor internal
> changes ("minor" from the POV of user-visible changes in behavior)
> will eventually bring us important features such as powerful text-mode
> completion.  Infrastructure that makes extensions easy is a Good
> Thing, but it is not enough to actually make those extensions happen,
> not by a long shot.

Absolutely, there's some more work to be done to accomplish what you
describe, no magic solutions here.  I propose to modernize completion in
text modes, opening a door for further developments.

> Which is why I prefer to make such internal reshuffling only together
> with installing the corresponding extensions, not as separate
> "cleanups".

Alright, although IMO this has concrete benefits beyond mere cleanup.
I'm fine with keeping this patch in a local branch for now, of course.

>> My concern here regards users that are used to pressing `C-M-i` in
>> `text-mode` and friends, and getting `ispell-complete-word`.  If we
>> follow my suggestion of removing this binding, `C-M-i` would invoke
>> `completion-at-point`, providing similar functionality but with a
>> different interface (by default that would be the *Completions*
>> buffer, instead of the *Choices* buffer that `ispell-complete-word`
>> provides).
>
> If that is the danger, it follows that we should make the UI of
> completion-at-point be able to support the UI of ispell-complete-word.

Sure, we could also add a `completion-in-region-function` that imitates
the current UI of `ispell-complete-word`, although IMO it's not really
an ideal interface for completions, so I'm not sure users would like
that for the rest of their `completion-at-point` calls.  That could be
made local in text mode buffers, perhaps.

> Btw, reusing the *Completions* buffer might cause problems on its own,
> regardless of the ispell-complete-word issue: what if this completion
> is invoked while typing at the prompt of a command that already popped
> up the *Completions* buffer?

That's interesting.  I guess Emacs could keep a stack of such nested
completion sessions and restore the first session when the other ends.
I'm not sure if there's something of that sorts in place.  Indeed,
that's a broader issue than the one at hand.

> Something to think about, I guess, if we are going to add more and
> more of these completion-at-point frameworks and features.


Thanks,

Eshel



  reply	other threads:[~2023-11-18 15:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 12:03 Word completion in text modes Eshel Yaron
2023-11-18 12:39 ` Eli Zaretskii
2023-11-18 13:21   ` Eshel Yaron
2023-11-18 13:50     ` Eli Zaretskii
2023-11-18 15:53       ` Eshel Yaron [this message]
2023-11-18 16:03         ` [External] : " Drew Adams
2023-11-18 16:37         ` Eli Zaretskii
2023-11-18 19:03           ` Eshel Yaron
2023-11-18 19:18             ` Eli Zaretskii
2023-11-21 13:45               ` Eshel Yaron
2023-11-25 10:40                 ` Eli Zaretskii
2023-11-25 12:11                   ` Eshel Yaron
2023-11-25 12:33                     ` Eli Zaretskii
2023-11-25 13:00                       ` Eshel Yaron
2023-11-26 10:31                         ` Eli Zaretskii
2023-11-26 11:03                           ` Eshel Yaron
2023-11-26 11:23                             ` Eli Zaretskii
2023-11-18 16:05   ` [External] : " Drew Adams
2023-11-18 16:55     ` Juergen Fenn
2023-11-18 18:33 ` Juri Linkov

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=m1a5rbukg7.fsf@dazzs-mbp.home \
    --to=me@eshelyaron.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.
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.