emacs-devel
[Top][All Lists]
Advanced

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

Re: Completions in Semantic


From: Eric M. Ludlam
Subject: Re: Completions in Semantic
Date: Mon, 19 Oct 2009 12:26:53 -0400

On Mon, 2009-10-19 at 09:48 -0400, Stefan Monnier wrote:
> > If you look at semantic-read-symbol, it does what you suggest, and
> > builds a table from the current buffer, and passes the whole thing into
> > completing-read.  That's ok for a single buffer, but not when you want
> > some symbol from anywhere in your project.  Of course, there is a basic
> > assumption that the user will do something like your example below,
> > typing in some prefix, before pressing TAB.  If the prompt comes up and
> > the user presses TAB right away, then there is no win.
> 
> I'm not sure I understand what you're saying, but it seems what you
> describe can be done as well with the "standard" completion mechanism,
> since the completion-table can be a function.
> 
> E.g. Info-complete-menu-item builds the table dynamically, using the
> prefix to try and build a smaller table, and reusing the previously
> built table if the completion is in the same context as the last one and
> the earlier prefix is a prefix of the new one.

I agree.  It just wasn't available when I wrote that stuff against Emacs
21.  (2003?)

> > Anyway, semantic-read-symbol works fine unless there are multiple
> > symbols with the same name, thus, a second thing that made me write my
> > own completion code is that tags are a little special, since they have
> > both names, and spacial data.  Sometimes, two tags are only different
> > based on their spacial data.  For example, when jumping to a tag, if
> > there are many hits with the same name (such as "window" in your example
> > below), you can press TAB several times, and it will flash where you
> > would jump to if you hit return, allowing you to differentiate.
> 
> That would require some custom completion code, indeed, since the
> current completion does not offer any hook for such things.  Of course,
> we could add such a hook, but we'd need to figure out where/how to
> do it.

There are a lot of interesting completing completion engines out there
on Emacswiki.  I would expect that a discussion on this topic would
invite a lot of opinions from different Emacs hackers.

Here are some of the things that could be discussed as worthwhile in the
built-in completion system:

* Differentiate between similarly named entities (as above).
  I called it a 'focus', meaning the user was focusing on 1 of many 
  options, but has not chosen it.
* Completion list with different text from what shows up on the prompt
  (another way to differentiate.)
* Inline completion in a buffer.  (ie - keymap, recursive-edit, 
  minibuffer like, but in the buffer text with the intention of 
  inserting that text..)
* Option for using a CLOS object as an input to these tools.
  (ie - completion classes inherit from some interface.)
  as a way of managing persistent data between completion events.
  Just a favorite of mine, I'm sure.

Thanks
Eric





reply via email to

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