[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: completion-ui.el question: my vimpulse-show-completion-menu function
From: |
Jason Spiro |
Subject: |
Re: completion-ui.el question: my vimpulse-show-completion-menu function always gives me an empty menu |
Date: |
Wed, 14 Mar 2007 14:24:45 -0400 |
Hi Toby,
2007/3/14, Toby Cubitt <t.s.cubitt.98-dated-1174279006.800fd7@cantab.net> wrote:
I'm not surprised it doesn't work, because you're using completion-UI in
completely the wrong way. (Excusable, since documentation is currently
fairly non-existent :-) Instead, set 'completion-function' to a function
that returns a list of possible completions, and leave completion-UI to
do its job.
Will try it - thanks for the explanation.
Your comment 2. is along the right lines: menu completion shouldn't be
implemented in the vimpulse code base, or indeed in the code base of any
other completion package. It should indeed be in something like the
hippie-expand package. But that's precisely what completion-UI is! All
the hippie-expand features, plus tooltips, menu-completion,
auto-completion, hotkey completion etc. etc. Completion-UI is supposed
to supersede hippie-expand, at least for in-buffer completion. So using
completion-UI and hippie-expand at the same time is unlikely to work
very well.
I decided on hippie-expand because it can complete:
- words (like dabbrev does)
- filenames
- entire buffer lines.
and more. I am trying to emulate Vim's completion behavior, and Vim
can complete all those things and more. Unfortunately it can't
complete multiple-word sequences like dabbrev can when you press M-/
SPC M-/ SPC M-/ but I hope someone else or I will add that later.
As an Elisp coder, you're not supposed to invoke *any* completion
interface explicitly, as you've tried to do. Deciding which combination
of user-interfaces to use is the user's business, not the package
writer's. Maybe some users want to use menu completion, but others
prefer to see a list in the echo area, whilst still others just want a
tooltip to popup after a delay, etc. etc. Completion-UI offloads those
choices onto the user, which is where they should be.
I want Vimpulse to emulate Vim's completion behavior: when you press
C-n, C-p, or any of the other completion keys in Insert mode: it shows
a menu. Is there a way to programmatically change a Customize
variable's default so that my change will take effect if and only if
the user does not customize that variable themselves?
I hope that makes things a bit clearer. I fully appreciate that using
completion-UI will be confusing until it's properly documented, although
the commentary at the beginning of completion-ui.el does tersely explain
how it should be used. (Setting 'completion-function' really is all
there is to it, I promise!)
I eagerly await that future day when it'll be better documented then :-)
Till then, do you know of any code examples that call completion-ui
that I could look at?
Cheers,
Jason
--
Jason Spiro: computer consulting with a smile.
I provide software development and training services to clients worldwide.
Contact me for a FREE consultation. Satisfaction guaranteed.
+1 (416) 781-5938 / Email: info@jspiro.com / MSN: jasonspiro@hotmail.com