From: "Drew Adams" <drew.adams@oracle.com>
Subject: Qs on obarrays
Date: Tue, 11 Oct 2005 17:52:57 -0700 [thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBEEAHCNAA.drew.adams@oracle.com> (raw)
The Elisp manual hints that you can create and fill an obarray like this:
(let ((my-obarray (make-vector 7 0)))
(dolist (name my-names) (intern name my-obarray))
(completing-read "XXX: " my-obarray))
That works. And this also works:
(let ((my-obarray (make-vector 7 0)))
(dolist (name my-names) (intern name my-obarray))
(all-completions "" my-obarray))
However, this does not seem to work for me:
(let ((my-obarray (make-vector 7 0)))
(dolist (name my-names) (intern name my-obarray))
(all-completions "" my-obarray 'commandp))
Even if all of my-names are symbol-names of commands, this always returns
nil. Any idea why?
Also, the obarray length must be supplied to make-vector. Anyone know a
heuristic for a good vector length to use when you expect a certain number
of symbols? I notice that the length of standard variable `obarray's value
is 1511 (prime, presumably). If I expect on the order of N symbols, what is
a good length to use? Or is there no simple formula? If not, anyone know a
good length for, say, 100 symbols?
(BTW - The obarray vector itself does not show all of the interned symbols,
when printed. I assume this is because if there are multiple symbols in the
same bucket only one of them can be printed when the vector is shown.)
next reply other threads:[~2005-10-12 0:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-12 0:52 Drew Adams [this message]
[not found] <mailman.10964.1129078391.20277.help-gnu-emacs@gnu.org>
2005-10-12 1:32 ` Qs on obarrays Pascal Bourguignon
2005-10-12 2:02 ` Drew Adams
2005-10-12 16:17 ` Kevin Rodgers
2005-10-12 17:14 ` Drew Adams
2005-10-12 18:23 ` Kevin Rodgers
2005-10-12 20:24 ` Drew Adams
2005-10-12 15:53 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MEEKKIABFKKDFJMPIOEBEEAHCNAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.