all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Help with completing-read
@ 2011-01-20 14:16 Perry Smith
  0 siblings, 0 replies; 3+ messages in thread
From: Perry Smith @ 2011-01-20 14:16 UTC (permalink / raw)
  To: help-gnu-emacs

The software I'm working on is doing this:

(let ((completing-read-func (if (null ido-mode)
                                  'completing-read
				'ido-completing-read)))
    (setq ri-topic (or ri-topic
                       (funcall completing-read-func
				"yari: "
				(yari-ruby-obarray rehash)
				nil
				t
				(yari-symbol-at-point)))))

The obarray has a list of methods with their complete class path like 
ActiveRecord::ConnectionAdapters::SchemaStatements#create_table

What I'd like to be able to do is allow the user to just type create_table and then
have a list of completions which would be the full class paths of for those
classes that have a create_table method.

What is the least painful way to do this?  I'm sorta ok competent with emacs lisp
but its not my strongest suit.

Thank you for your time,
Perry




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Help with completing-read
       [not found] <mailman.2.1295535257.22543.help-gnu-emacs@gnu.org>
@ 2011-01-20 19:19 ` Stefan Monnier
  2011-01-20 20:03   ` Perry Smith
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2011-01-20 19:19 UTC (permalink / raw)
  To: help-gnu-emacs

> The software I'm working on is doing this:
> (let ((completing-read-func (if (null ido-mode)
>                                   'completing-read
> 				'ido-completing-read)))
>     (setq ri-topic (or ri-topic
>                        (funcall completing-read-func
> 				"yari: "
> 				(yari-ruby-obarray rehash)
> 				nil
> 				t
> 				(yari-symbol-at-point)))))

> The obarray has a list of methods with their complete class path like 
> ActiveRecord::ConnectionAdapters::SchemaStatements#create_table

> What I'd like to be able to do is allow the user to just type
> create_table and then have a list of completions which would be the
> full class paths of for those classes that have a create_table method.

I'm not sure I understand the details of what you're asking for
(e.g. what part of the name do you want to list as completion, and where
do you want it to be listed).

Does ido-completing-read already do what you want?  If not, why not?
The default completion code provides a `substring' completion style in
Emacs-24 (not provided in Emacs-23) and it sounds close to what you
want, but OTOH ido-completing-read also provides it, so maybe you want
some else.

Or do you want something more like what filecache.el provides?


        Stefan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Help with completing-read
  2011-01-20 19:19 ` Stefan Monnier
@ 2011-01-20 20:03   ` Perry Smith
  0 siblings, 0 replies; 3+ messages in thread
From: Perry Smith @ 2011-01-20 20:03 UTC (permalink / raw)
  To: help-gnu-emacs


On Jan 20, 2011, at 1:19 PM, Stefan Monnier wrote:

>> The software I'm working on is doing this:
>> (let ((completing-read-func (if (null ido-mode)
>>                                  'completing-read
>> 				'ido-completing-read)))
>>    (setq ri-topic (or ri-topic
>>                       (funcall completing-read-func
>> 				"yari: "
>> 				(yari-ruby-obarray rehash)
>> 				nil
>> 				t
>> 				(yari-symbol-at-point)))))
> 
>> The obarray has a list of methods with their complete class path like 
>> ActiveRecord::ConnectionAdapters::SchemaStatements#create_table
> 
>> What I'd like to be able to do is allow the user to just type
>> create_table and then have a list of completions which would be the
>> full class paths of for those classes that have a create_table method.
> 
> I'm not sure I understand the details of what you're asking for
> (e.g. what part of the name do you want to list as completion, and where
> do you want it to be listed).
> 
> Does ido-completing-read already do what you want?  If not, why not?
> The default completion code provides a `substring' completion style in
> Emacs-24 (not provided in Emacs-23) and it sounds close to what you
> want, but OTOH ido-completing-read also provides it, so maybe you want
> some else.
> 
> Or do you want something more like what filecache.el provides?

ido-mode seems what I wanted.  At least it is 99% there.

But, just to clarify, the entries in my list look like:

ActiveRecord::ConnectionAdapters::SchemaStatements#create_table

I wanted to be able to type (or start typing) any of these substrings:

ActiveRecord::ConnectionAdapters::SchemaStatements#create_table
ConnectionAdapters::SchemaStatements#create_table
SchemaStatements#create_table
create_table

So, if I type "creat" and hit tab, it would find 

ActiveRecord::ConnectionAdapters::SchemaStatements#create_table

in the list and offer it to me as one of the completions.

I assumed I would have to hook in to the completion process at some point
and was trying to figure out where.

With ido-mode turned on, I am getting a super set of what I wanted but
thats fine.  I noticed the ido-mode flag and glanced at the documentation
but it seemed buffer and file specific.

Thanks again for your time.

Perry




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-20 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 14:16 Help with completing-read Perry Smith
     [not found] <mailman.2.1295535257.22543.help-gnu-emacs@gnu.org>
2011-01-20 19:19 ` Stefan Monnier
2011-01-20 20:03   ` Perry Smith

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.