[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Qs on obarrays
From: |
Drew Adams |
Subject: |
RE: Qs on obarrays |
Date: |
Wed, 12 Oct 2005 10:14:40 -0700 |
An alternative is to change just the predicate to check the standard
obarray:
(let ((my-obarray (make-vector 7 0)))
(dolist (name my-names) (intern name my-obarray))
(all-completions "" my-obarray
(lambda (symbol)
(commandp (intern (symbol-name symbol))))))
I ended up doing something similar, since the original predicate (commandp)
will only work with the standard `obarray' (as Pascal pointed out so well).
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)
Thanks to all for the input.
Re: Qs on obarrays, Stefan Monnier, 2005/10/12