emacs-devel
[Top][All Lists]
Advanced

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

Re: `completion-in-region'


From: Leo
Subject: Re: `completion-in-region'
Date: Mon, 12 Apr 2010 16:51:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

On 2010-04-11 16:32 +0100, Stefan Monnier wrote:
>>> completion-in-region-functions is indeed meant for situations where you
>>> want to either completely replace the completion UI with some other one
>>> (à la completion-ui.el), or where you want to let-bind some completion
>>> variables.  But indeed, it hasn't been used much yet, so maybe a better
>>> interface would make sense.
>> BTW, some modern text editors (such as textmate) have started offering
>> fuzzy completion as default.
>
> Interesting.  Do you have any details of what is meant by "fuzzy"?
> [ BTW, I expect fuzzy matching to be a completion-style rather than
>   a completion-ui.  The IO part is the part that chooses which keys do
>   what, where/how to display the list of completions, etc... whereas
>   the completion-style controls what is the possible list of
>   completions given a completion-table and a user input.  ]

I haven't used textmate. I am afraid if I try it I might like it. So
that comment is from me watching a few screencasts of textmate. There
are a lot of them on the internet.

And using ido and the fuzzy completion in slime. None seems to suggest
it is a bad default.

>> I was trying to return a list of (beg end collections) and let
>> completion-in-region do the job. But in the end I did something like
>> this:
>
>> (defun TeX-completion-at-point ()
>>   (let ((list TeX-complete-list) entry)
>>     (while list
>>       (setq entry (car list)
>>           list (cdr list))
>>       (if (TeX-looking-at-backward (car entry) 250)
>>         (setq list nil)))
>>     ;; ignore the useless ispell completion
>>     (when (numberp (nth 1 entry))
>>       (when (looking-at "\\w")
>>         (forward-word 1))
>>       (TeX-complete-symbol)
>>       ;; try leaving point in between parenthesis
>>       (when (looking-back "\\s)" (line-beginning-position))
>>         (skip-syntax-backward ")"))
>>       ;; this is discouraged
>>       ;; return a function that does nothing
>>       'ignore)))
>
> I don't see where this adds a terminating }.

TeX-complete-symbol from AUCTeX does that automatically.

>> I haven't used pcomplete before so I will look at it later on.
>
> My suggestion doesn't have anything to do with pcomplete.el except for
> the fact that it's one place where I've used c-t-with-terminator.
> I.e. I'm suggesting you use completion-table-with-terminator and the
> pcomplete.el is just telling you where you can see it in use.
> But "grep completion-table-with-terminator lisp/**/*.el" will show you
> a few other uses (in meta-mode and make-mode, for example).

OK. I will keep that in mind.

[...]
>> The completion I was talking about was for function
>> `snippet-completion-at-point' which completes abbrevs and do the
>> expansion if the completed string is an abbrev name; the abbrev
>> expansion is then processed by snippet-region.
>
> I see.  So what problems have you encountered in this context?

Currently no except it returns a function which is discouraged as said
in the doc string of `completion-at-point-functions'.

> [ BTW, you may want to generalize it to abbrev-complete-at-point since
>   it's likely to be easy to generalize to any abbreviation table.
>   We could install this in abbrev.el.  ]
> 
>         Stefan

I have added this to my TODO. Unfortunately I might be away from
internet for quite a while but I will send that in next time if nobody
does that already.

Thanks.

Leo





reply via email to

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