unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Vitalie Spinu <spinuvit@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: comint-filename-completion and :exclusive completion bugs
Date: Wed, 14 Mar 2012 09:53:57 -0400	[thread overview]
Message-ID: <jwvobrzux7v.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ehsvh0fv.fsf@gmail.com> (Vitalie Spinu's message of "Wed, 14 Mar 2012 12:44:04 +0100")

> 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.


        Stefan



  reply	other threads:[~2012-03-14 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 11:44 comint-filename-completion and :exclusive completion bugs Vitalie Spinu
2012-03-14 13:53 ` Stefan Monnier [this message]
2012-03-14 14:54   ` Vitalie Spinu
2012-03-14 15:45     ` Stefan Monnier
2012-03-14 21:51       ` Vitalie Spinu

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=jwvobrzux7v.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=spinuvit@gmail.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).