emacs-devel
[Top][All Lists]
Advanced

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

Re: `completion-in-region'


From: Stefan Monnier
Subject: Re: `completion-in-region'
Date: Thu, 08 Apr 2010 23:05:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> completion-in-region allows a complete customise of its behaviour
> through completion-in-region-functions.  But minibuffer-message blocks
> execution for minibuffer-message-timeout seconds (default to 2) unless
> there's input from user.

Yes, that's a known problem in minibuffer-message, indeed.
Patches welcome.

> For example if I define my own:
> (defun my-completion-in-region (next-fun start end collection predicate)
>   (when (funcall next-fun start end collection predicate)
>   BODY))

> BODY will only be executed after 2 seconds that gives a false slow user
> experience. I can work around this problem by let-binding
> minibuffer-message-timeout to 0. But I think some improvement can be done
> here.

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.

> The above comments are based on my experience to write two
> completions: one for TeX: I want the completion to automatically
> include a 'close' string (i.e.  {} for LaTeX macros etc.), I can write
> a function for completion-at-point-functions which returns '(beg end
> completion-function) and do the adding in completion-function but it
> is difficult to control the position of point so that it locates
> between {}.

Could you expand on what problems you've encountered when trying to add
it in completion-function?  You may want to check how I used
completion-table-with-terminator in pcomplete.el for that same kind
of situation.

> Another solution is to customise completion-in-region through
> completion-in-region-functions but I need to isolate the interference
> between functions in completion-in-region-functions.

That doesn't seem like a good approach to add a terminating }

> Another for snippet (similar to abbrev), complete the snippet (abbrev) and
> then expand if completion succeeds.

Hmm... I do not understand the above two lines.  They seem to lack
context or something.


        Stefan




reply via email to

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