aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-14 11:39:50 +0000
committerEli Zaretskii2008-10-14 11:39:50 +0000
commit22526bc41679a701cb95e75f17ac138153535b03 (patch)
tree5d0de4aeec0aeb2d65cba4445aa93499a1c2db34
parente16acc2c370b280d8dcb2deea59cc015e45def47 (diff)
downloademacs-22526bc41679a701cb95e75f17ac138153535b03.tar.gz
emacs-22526bc41679a701cb95e75f17ac138153535b03.zip
(Char-Tables): `map-char-table' can now call its argument FUNCTION with
a cons cell as KEY.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/sequences.texi36
2 files changed, 27 insertions, 14 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 1fab2aeee88..926e424beb2 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12008-10-14 Eli Zaretskii <eliz@gnu.org>
2
3 * sequences.texi (Char-Tables): `map-char-table' can now call its
4 argument FUNCTION with a cons cell as KEY.
5
12008-10-13 Eli Zaretskii <eliz@gnu.org> 62008-10-13 Eli Zaretskii <eliz@gnu.org>
2 7
3 * objects.texi (Primitive Function Type): Move "@cindex special 8 * objects.texi (Primitive Function Type): Move "@cindex special
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index df4ac951748..c86771fcb25 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -658,30 +658,38 @@ name. @xref{Splitting Characters}, for a description of generic characters.
658@end defun 658@end defun
659 659
660@defun map-char-table function char-table 660@defun map-char-table function char-table
661This function calls @var{function} for each element of @var{char-table}. 661This function calls the specified @var{function} for each element of
662@var{char-table} that has a non-@code{nil} value.
662@var{function} is called with two arguments, a key and a value. The key 663@var{function} is called with two arguments, a key and a value. The key
663is a possible @var{range} argument for @code{char-table-range}---either 664is a possible @var{range} argument for @code{char-table-range}---either
664a valid character or a generic character---and the value is 665a valid character or a cons cell @code{(@var{from} . @var{to})},
665@code{(char-table-range @var{char-table} @var{key})}. 666specifying a range of characters that share the same value. The value is
667what @code{(char-table-range @var{char-table} @var{key})} returns.
666 668
667Overall, the key-value pairs passed to @var{function} describe all the 669Overall, the key-value pairs passed to @var{function} describe all the
668values stored in @var{char-table}. 670values stored in @var{char-table}.
669 671
670The return value is always @code{nil}; to make this function useful, 672The return value is always @code{nil}; to make calls to
671@var{function} should have side effects. For example, 673@code{map-char-table} useful, @var{function} should have side effects.
672here is how to examine each element of the syntax table: 674For example, here is how to examine the elements of the syntax table:
673 675
674@example 676@example
675(let (accumulator) 677(let (accumulator)
676 (map-char-table 678 (map-char-table
677 #'(lambda (key value) 679 #'(lambda (key value)
678 (setq accumulator 680 (setq accumulator
679 (cons (list key value) accumulator))) 681 (cons (list
680 (syntax-table)) 682 (if (consp key)
681 accumulator) 683 (list (car key) (cdr key))
684 key)
685 value)
686 accumulator)))
687 (syntax-table))
688 accumulator)
682@result{} 689@result{}
683((475008 nil) (474880 nil) (474752 nil) (474624 nil) 690(((2597602 4194303) (2)) ((2597523 2597601) (3))
684 ... (5 (3)) (4 (3)) (3 (3)) (2 (3)) (1 (3)) (0 (3))) 691 ... (65379 (5 . 65378)) (65378 (4 . 65379)) (65377 (1))
692 ... (12 (0)) (11 (3)) (10 (12)) (9 (0)) ((0 8) (3)))
685@end example 693@end example
686@end defun 694@end defun
687 695