unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vitalie Spinu <spinuvit@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: comint-filename-completion and :exclusive completion bugs
Date: Wed, 14 Mar 2012 15:54:02 +0100	[thread overview]
Message-ID: <87obrzb5dh.fsf@gmail.com> (raw)
In-Reply-To: jwvobrzux7v.fsf-monnier+emacs@gnu.org

>>>> Stefan Monnier <monnier@iro.umontreal.ca>
>>>> 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)
    ))

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

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

Thanks, 
Vitalie.




  reply	other threads:[~2012-03-14 14:54 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
2012-03-14 14:54   ` Vitalie Spinu [this message]
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=87obrzb5dh.fsf@gmail.com \
    --to=spinuvit@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).