help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Qs on obarrays


From: Kevin Rodgers
Subject: Re: Qs on obarrays
Date: Wed, 12 Oct 2005 12:23:11 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Drew Adams wrote:
> Actually, I don't bother creating a new obarray, after all. I just use an
> alist (easier to manipulate) and redefine the predicate to work with that:
>
> (all-completions "" my-alist (lambda (elt) (commandp (intern (car elt)))))
>
> Or, more generally (what I really do):
>
> (when (arrayp minibuffer-completion-table)
>   (setq minibuffer-completion-predicate
>         `(lambda (elt)
>             (funcall ',minibuffer-completion-predicate
>                      (intern (car elt))))))
> (setq minibuffer-completion-table
>       my-alist) ; Built by filtering `minibuffer-completion-table'.
> ...
> (all-completions "" minibuffer-completion-table
>                  minibuffer-completion-predicate)

I wouldn't recommend setq'ing minibuffer-completion-table and
-predicate.  Those variables (plus -confirm) are let-bound by Emacs' own
higher level completion functions, and I think it'd be cleaner if you
did the same -- or just set your own my-completion-table and -predicate
variables, since you're passing their values explicitly to
all-completions anyway.

--
Kevin Rodgers





reply via email to

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