[Top][All Lists]

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

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

From: Vitalie Spinu
Subject: Re: comint-filename-completion and :exclusive completion bugs
Date: Wed, 14 Mar 2012 15:54:02 +0100
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/23.3 (gnu/linux)

>>>> Stefan Monnier <address@hidden>
>>>> on Wed, 14 Mar 2012 09:53:57 -0400 wrote:

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

I don't really understand how :exlusive 'no prevent partial completion
(in case you mean the obsolete package complete.el). So if there is no
partial expansion of foo_bar|, doesn't :exlusive pass the handling over?
You probably mean some advanced, usage pattern.

comint-filename-completion is active in all comint buffers, and it
prevents the completion UI to reach the global
tags-completion-at-point-function. And this is a bit of a limitation. 

In other modes than comint, file completion of 'sdfdsf, or anything else
not prefixed by "/", or even not quoted, is not a filename, and should
be passed over.

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

That would be great, for the simple reason that hacking
comint-filename-completion, in order to be used in other modes, is a bit
difficult. A real example:

(defun ess-filename-completion ()
  "Return completion only within string or comment."
  (when (ess-inside-string-or-comment-p (point))

Comint-filename-completion returns a list of length 2 or 3 depending on
filesuffix. So to tweak it, I have to check for the length, if 2,
append, if 3 insert :exclusive into the last list. Ugly as far as I am

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

Yes, this is what is now in ESS, but a knowledgeable user of emacs 24
would expect his tags completion to be reached.

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

Dammit, sorry for this noise, should have been named it
`sdfseref-completion`, this explains the wreckage.


reply via email to

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