summaryrefslogtreecommitdiff
path: root/doc/lispref/hash.texi
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2009-12-25 20:04:07 +0000
committerChong Yidong <cyd@stupidchicken.com>2009-12-25 20:04:07 +0000
commit16d1ff5f0b813254c882b924fc4f907f3bbd435e (patch)
tree3c7868335a3442e8e7fc51dc3b971a4eb5fdfa42 /doc/lispref/hash.texi
parent91ed7ea8643c021003fc6073b5226ea49e196688 (diff)
downloademacs-16d1ff5f0b813254c882b924fc4f907f3bbd435e.tar.gz
* frames.texi (Resources): Describe inhibit-x-resources.
(Size Parameters): Copyedit. * hash.texi (Creating Hash): * objects.texi (Hash Table Type): Document the new hash table printed representation. * minibuf.texi (Basic Completion): 4th arg to all-completions is obsolete. * processes.texi (Process Buffers): Document process-kill-buffer-query-function.
Diffstat (limited to 'doc/lispref/hash.texi')
-rw-r--r--doc/lispref/hash.texi48
1 files changed, 36 insertions, 12 deletions
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index dd785f8fd7c..8453e780a51 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -30,18 +30,13 @@ the way two alists can share a common tail.
@end itemize
Emacs Lisp provides a general-purpose hash table data type, along
-with a series of functions for operating on them. Hash tables have no
-read syntax, and print in hash notation, like this:
-
-@example
-(make-hash-table)
- @result{} #<hash-table 'eql nil 0/65 0x83af980>
-@end example
-
-@noindent
-(The term ``hash notation'' refers to the initial @samp{#}
-character---@pxref{Printed Representation}---and has nothing to do with
-the term ``hash table.'')
+with a series of functions for operating on them. Hash tables have a
+special printed representation, which consists of @samp{#s} followed
+by a list specifying the hash table properties and contents.
+@xref{Creating Hash}. (Note that the term ``hash notation'', which
+refers to the initial @samp{#} character used in the printed
+representations of objects with no read representation, has nothing to
+do with the term ``hash table''. @xref{Printed Representation}.)
Obarrays are also a kind of hash table, but they are a different type
of object and are used only for recording interned symbols
@@ -164,6 +159,35 @@ of key lookup.
This function is obsolete. Use @code{make-hash-table} instead.
@end defun
+You can also create a new hash table using the printed representation
+for hash tables. The Lisp reader can read this printed
+representation, provided each element in the specified hash table has
+a valid read syntax (@pxref{Printed Representation}). For instance,
+the following specifies a new hash table containing the keys
+@code{key1} and @code{key2} (both symbols) associated with @code{val1}
+(a symbol) and @code{300} (a number) respectively.
+
+@example
+#s(hash-table size 30 data (key1 val1 key2 300))
+@end example
+
+@noindent
+The printed representation for a hash table consists of @samp{#s}
+followed by a list beginning with @samp{hash-table}. The rest of the
+list should consist of zero or more property-value pairs specifying
+the hash table's properties and initial contents. The properties and
+values are read literally. Valid property names are @code{size},
+@code{test}, @code{weakness}, @code{rehash-size},
+@code{rehash-threshold}, and @code{data}. The @code{data} property
+should be a list of key-value pairs for the initial contents; the
+other properties have the same meanings as the matching
+@code{make-hash-table} keywords (@code{:size}, @code{:test}, etc.),
+described above.
+
+Note that you cannot specify a hash table whose initial contents
+include objects that have no read syntax, such as buffers and frames.
+Such objects may be added to the hash table after it is created.
+
@node Hash Access
@section Hash Table Access