From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: Qs on obarrays Date: Tue, 11 Oct 2005 17:52:57 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1129078430 25564 80.91.229.2 (12 Oct 2005 00:53:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Oct 2005 00:53:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 12 02:53:46 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EPUrz-00025X-OQ for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2005 02:53:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPUrz-0002yS-63 for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Oct 2005 20:53:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EPUrl-0002y5-4S for help-gnu-emacs@gnu.org; Tue, 11 Oct 2005 20:53:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EPUrj-0002xl-K8 for help-gnu-emacs@gnu.org; Tue, 11 Oct 2005 20:53:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPUrj-0002xi-H7 for help-gnu-emacs@gnu.org; Tue, 11 Oct 2005 20:53:07 -0400 Original-Received: from [141.146.126.231] (helo=agminet04.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EPUrj-0000GT-NI for help-gnu-emacs@gnu.org; Tue, 11 Oct 2005 20:53:07 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by agminet04.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j9C0r5mK005640 for ; Tue, 11 Oct 2005 19:53:06 -0500 Original-Received: from rgmsgw300.us.oracle.com (localhost [127.0.0.1]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j9C0r5iH018783 for ; Tue, 11 Oct 2005 18:53:05 -0600 Original-Received: from dradamslap (dhcp-amer-rmdc-csvpn-gw6-141-144-112-63.vpn.oracle.com [141.144.112.63]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id j9C0qwDs018758 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Tue, 11 Oct 2005 18:53:05 -0600 Original-To: "Help-Gnu-Emacs" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30155 Archived-At: 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.)