unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Amai Kinono <amaikinono@gmail.com>
Cc: 39600@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion functions
Date: Sat, 08 Aug 2020 16:04:10 +0200	[thread overview]
Message-ID: <874kpdz12d.fsf@gnus.org> (raw)
In-Reply-To: <CAPu3fz2upooTeN7XmQt7q=W1FGxyk1pzaVqg+TQkEz7OnEYeaA@mail.gmail.com> (Amai Kinono's message of "Fri, 14 Feb 2020 15:34:19 +0800")

Amai Kinono <amaikinono@gmail.com> writes:

> Currently, with non-exclusive completion functions, Emacs will do
> `try-completion` on the current text, and decide whether to try next
> completion function based on that. This makes completion functions that
> can do non-prefix completions fails when the current text only occurs in
> the middle of the candidates. This is a problem I found in a FIXME in
> the code.
>
> # How does this work?
>
> I use `completion-all-completions` instead. As far as I know, this
> respects the `completion-styles`.

[...]

Stefan, how does this patch look to you?

> -               ;; FIXME: Here we'd need to decide whether there are
> -               ;; valid completions against the current text.  But this depends
> -               ;; on the actual completion UI (e.g. with the default completion
> -               ;; it depends on completion-style) ;-(
> -               ;; We approximate this result by checking whether prefix
> -               ;; completion might work, which means that non-prefix completion
> -               ;; will not work (or not right) for completion functions that
> -               ;; are non-exclusive.
> -               (null (try-completion (buffer-substring-no-properties
> -                                      (car res) (point))
> -                                     (nth 2 res)
> -                                     (plist-get (nthcdr 3 res) :predicate)))
> +               (null (completion-all-completions
> +                      (buffer-substring-no-properties (car res) (point))
> +                      (nth 2 res)
> +                      (plist-get (nthcdr 3 res) :predicate)
> +                      (- (point) (car res))))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-08-08 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  7:34 bug#39600: [PATCH] Fix handling of non-exclusive non-prefix completion functions Amai Kinono
2020-08-08 14:04 ` Lars Ingebrigtsen [this message]
2020-08-08 21:58   ` Stefan Monnier

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=874kpdz12d.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=39600@debbugs.gnu.org \
    --cc=amaikinono@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).