all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62836@debbugs.gnu.org, sbaugh@catern.com
Subject: bug#62836: [PATCH] Provide an example of using fuzzier completion.
Date: Tue, 18 Apr 2023 18:07:26 -0400	[thread overview]
Message-ID: <ierh6tcyhcx.fsf@janestreet.com> (raw)
In-Reply-To: <83sfd0bc8c.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 16 Apr 2023 08:57:39 +0300")

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:
>> From: sbaugh@catern.com
>> Date: Sat, 15 Apr 2023 22:22:09 +0000 (UTC)
>> Cc: Spencer Baugh <sbaugh@janestreet.com>, 62836@debbugs.gnu.org
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > Finally, please use @kbd{@key{TAB}} in the context that calls for the
>> > user to press the TAB key.
>> 
>> Hm, the text already present in the "Completion Example" section doesn't
>> use @kbd{@key{TAB}}, should it be doing that?
>
> Those are mistakes--these 2 paragraphs:
>
>     If you type @key{TAB} again immediately, it cannot determine the
>   next character; it could be @samp{-}, @samp{a}, or @samp{c}.  So it
>   does not add any characters; instead, @key{TAB} displays a list of all
>   possible completions in another window.
>
>     Next, type @kbd{-f}.  The minibuffer now contains @samp{auto-f}, and
>   the only command name that starts with this is @code{auto-fill-mode}.
>   If you now type @key{TAB}, completion fills in the rest of the
>   argument @samp{auto-fill-mode} into the minibuffer.
>
> should use @kbd{@key{TAB}} where they say "when you type".  Feel free
> to fix those blunders as part of the patch.
>
>> Here's the revised version incorporating all of these:
>> 
>>   @key{TAB} also works while point is not at the end of the
>> minibuffer.  In that case, it will fill in text both at point and at
>> the end of the minibuffer.  If you type @kbd{M-x autocm}, then press
>> @kbd{C-b} to move point before the @samp{m}, you can type
>> @kbd{@key{TAB}} to insert the text @samp{onf-} at point and @samp{ode}
>> at the end of the minibuffer, so that the minibuffer contains
>> @samp{autoconf-mode}.
>
> LGTM, thanks.

Cool, here's the patch then:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Give-an-example-of-completion-with-point-not-at-end-.patch --]
[-- Type: text/x-patch, Size: 2445 bytes --]

From 592541aaec70400e69f27d9f2f2a6972f203e30f Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Tue, 18 Apr 2023 18:03:36 -0400
Subject: [PATCH] Give an example of completion with point not at end of
 minibuffer

This can be a useful substitute for full-on fuzzy completion, as
provided by other completion styles and completion packages.

* doc/emacs/mini.texi (Completion Example): Give an example of
completion with point not at end of minibuffer.  Also, use
@kbd{@key{TAB}} when telling the user to hit TAB.
---
 doc/emacs/mini.texi | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 812218d1ab2..c75d68b4f69 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -313,14 +313,14 @@ Completion Example
 called @code{authorize-me} was defined, Emacs could only complete
 as far as @samp{aut}.)
 
-  If you type @key{TAB} again immediately, it cannot determine the
-next character; it could be @samp{-}, @samp{a}, or @samp{c}.  So it
-does not add any characters; instead, @key{TAB} displays a list of all
-possible completions in another window.
+  If you type @kbd{@key{TAB}} again immediately, it cannot determine
+the next character; it could be @samp{-}, @samp{a}, or @samp{c}.  So
+it does not add any characters; instead, @key{TAB} displays a list of
+all possible completions in another window.
 
   Next, type @kbd{-f}.  The minibuffer now contains @samp{auto-f}, and
 the only command name that starts with this is @code{auto-fill-mode}.
-If you now type @key{TAB}, completion fills in the rest of the
+If you now type @kbd{@key{TAB}}, completion fills in the rest of the
 argument @samp{auto-fill-mode} into the minibuffer.
 
   Hence, typing just @kbd{a u @key{TAB} - f @key{TAB}} allows you to
@@ -340,6 +340,14 @@ Completion Example
 the end of the minibuffer, so that the minibuffer contains
 @code{autoconf-mode}.
 
+  @key{TAB} also works while point is not at the end of the
+minibuffer.  In that case, it will fill in text both at point and at
+the end of the minibuffer.  If you type @kbd{M-x autocm}, then press
+@kbd{C-b} to move point before the @samp{m}, you can type
+@kbd{@key{TAB}} to insert the text @samp{onf-} at point and @samp{ode}
+at the end of the minibuffer, so that the minibuffer contains
+@samp{autoconf-mode}.
+
 @node Completion Commands
 @subsection Completion Commands
 
-- 
2.30.2


  reply	other threads:[~2023-04-18 22:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 15:01 bug#62836: [PATCH] Provide an example of using fuzzier completion Spencer Baugh
2023-04-15  8:34 ` Eli Zaretskii
2023-04-15 22:22   ` sbaugh
2023-04-16  5:57     ` Eli Zaretskii
2023-04-18 22:07       ` Spencer Baugh [this message]
2023-04-19 12:26         ` Eli Zaretskii

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=ierh6tcyhcx.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=62836@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sbaugh@catern.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.