emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs completion matches selection UI


From: Dmitry Gutov
Subject: Re: Emacs completion matches selection UI
Date: Tue, 31 Dec 2013 18:30:47 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hello Toby,

When I looked into the different completion interfaces available for
Emacs, Completion-UI came out a lowest denominator in terms of features
that can be supported by completion backends.

Both Company and Auto-Complete support displaying candidate "summaries"
(usually calltips and/or first line of the candidate's docstring),
fuller documentation (in a new buffer, or in a popup, respectively), and
Company also allows backends to return the candidate's location (as a
position in a buffer or a line in a file), which has a respective "show
definition" command. These are quite useful for programming.

Completion-UI, from what I can tell, only considers candidates as
strings to be inserted, without any introspection facilities. Even the
Elisp source looks like this:

(completion-ui-register-source
 all-completions
 :completion-args 1
 :other-args (obarray)
 :name elisp
 :word-thing symbol)

...which is miles behind both `company-elisp' and
`lisp-completion-at-point'.

And because your source interface doesn't provide much, Completion-UI
user-interfaces don't handle the extra options either. So, as things
currently stand, if one was to write translation functions from Company
backends and Auto-Complete sources, a whole slice of their features
would be lost (see `company-backends' docstring for some details).

Conversely, Company also provides swappable front-ends (see the
docstring of `company-frontends'), so from where I stand, it should be
easier to adapt any widgets you have implemented that we don't have as
new Company front-ends.

Toby Cubitt <address@hidden> writes:
> - has completely modularised completion user-interfaces, which can be
>   used in any combination the user likes (within reason)

You can have some of that in Company by setting `company-frontends' to a
buffer-local value. Probably. I've never tried that, though, and I'm not
sure if I'll ever want to, personally.

> - comes with all the UIs people usually ask for: in-buffer text
>   completion, tooltips (both real tooltips, and the "pop-up tip"
>   overlay-based tooltips), drop-down menus, pop-up mini-frames, list of
>   completions in echo area, hotkeys to select completions...

Company doesn't have mini-frames and, I guess, drop-down menus. Is the
latter a graphical menu that only allows interaction with mouse and
arrow keys?

> - lets you add a new completion UI with a single call to the
>   `completion-ui-register-interface' macro

Company allows you to do that with a handy macro called `defun'.

> - lets you register a new completion source with a single call to the
>   `completion-ui-register-source' macro

Ditto.

> Completion-UI isn't another company-mode or anything or auto-complete-mode.
> It was always intended to be "plumbing": a generic completion user-interface
> toolkit that other packages could use, to unify the interface for selecting
> completions in Emacs. It would, I think, be rather easy to modify
> company-mode, auto-complete-mode, anything.el, etc. to use completion-UI
> instead of their built-in UI code.

See above. It would be a lossy conversion.

Also, I think `company-backends' provides a nicer API than
`completion-ui-register-source'.

> I use (a slightly modified version of) Tomohiro
> Matsuyama's popup.el library for the overlay-based tooltips. I don't know
> if Tomohiro has papers on file.

It would be nice to be able to use it, but from what I see Matsuyama is
not the sole significant contributor. I opened a related issue
(https://github.com/auto-complete/popup-el/issues/50), but there's been
no response so far.

By the way, why are you bundling a modified version of popup.el instead
of contributing the changes upstream?



reply via email to

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