[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comint-filename-completion and :exclusive completion bugs

From: Stefan Monnier
Subject: Re: comint-filename-completion and :exclusive completion bugs
Date: Wed, 14 Mar 2012 09:53:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

> Place the point after 'sfsdf  and M-x completion-at-point.  You will get
> "No-match" message.  The intended behavior is to pass over to next
> completion function `test-completion'.

Actually, no this is not the intended behavior (unless you
specify :exclusive 'no): functions on completion-at-point-functions are
supposed to only return non-nil if the text at point is one for which
they intend  to take responsibility.

This is important, because it then allows completion-styles to try
harder ("aha! there's no matching prefix?  well, let's see if there's
some other way to find a match").  Otherwise, the completion UI gets
a dilemma: in case of completion style fails, should it try the next
completion style, or should it try to fallback on the next
completion data?

The ":exclusive 'no" solves this dilemma by only allowing prefix
completion.  I think that for filename completion, non-prefix completion
is important, so while I can agree that comint-filename-completion often
isn't really sure whether it should take responsibility (because it
doesn't actually know that there should be a filename at point),
preventing things like partial-completion on filenames would be sad.

Maybe we could provide a comint-maybe-filename-completion which would
set the ":exclusive 'no", for situations like yours where you prefer
falling back on some other completion data if the text isn't a prefix of
a valid filename.

Or maybe you can change your own completion function so that rather than
placing it after comint-filename-completion, you can place it before.

> Now it works after 'sfsfd, but it reveals the following problem with
> :exlusive argument:
> Place your cursor after /bin and M-x completion-at-point, which
> completes to /bin/, but calls test-completion with 3 arguments:

`test-completion' is a predefined function taking 3 args, which you just
redefined as something completely different, leading to all kinds of
funny results.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]