Mercurial > hg > xemacs-beta
comparison man/lispref/text.texi @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children | da8ed4261e83 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
68 is omitted. (In FSF Emacs, and earlier versions of XEmacs, these | 68 is omitted. (In FSF Emacs, and earlier versions of XEmacs, these |
69 functions usually did not have these optional @var{buffer} arguments | 69 functions usually did not have these optional @var{buffer} arguments |
70 and always operated on the current buffer.) | 70 and always operated on the current buffer.) |
71 | 71 |
72 | 72 |
73 @defun char-after &optional position buffer | 73 @defun char-after position &optional buffer |
74 This function returns the character in the buffer at (i.e., | 74 This function returns the character in the buffer at (i.e., |
75 immediately after) position @var{position}. If @var{position} is out of | 75 immediately after) position @var{position}. If @var{position} is out of |
76 range for this purpose, either before the beginning of the buffer, or at | 76 range for this purpose, either before the beginning of the buffer, or at |
77 or beyond the end, then the value is @code{nil}. The default for | 77 or beyond the end, then the value is @code{nil}. If optional argument |
78 @var{position} is point. If optional argument @var{buffer} is | 78 @var{buffer} is @code{nil}, the current buffer is assumed. |
79 @code{nil}, the current buffer is assumed. | |
80 | 79 |
81 In the following example, assume that the first character in the | 80 In the following example, assume that the first character in the |
82 buffer is @samp{@@}: | 81 buffer is @samp{@@}: |
83 | 82 |
84 @example | 83 @example |
85 @group | 84 @group |
86 (char-to-string (char-after 1)) | 85 (char-to-string (char-after 1)) |
87 @result{} "@@" | 86 @result{} "@@" |
88 @end group | 87 @end group |
89 @end example | 88 @end example |
90 @end defun | |
91 | |
92 @defun char-before &optional position buffer | |
93 This function returns the character in the current buffer immediately | |
94 before position @var{position}. If @var{position} is out of range for | |
95 this purpose, either at or before the beginning of the buffer, or beyond | |
96 the end, then the value is @code{nil}. The default for | |
97 @var{position} is point. If optional argument @var{buffer} is | |
98 @code{nil}, the current buffer is assumed. | |
99 @end defun | 89 @end defun |
100 | 90 |
101 @defun following-char &optional buffer | 91 @defun following-char &optional buffer |
102 This function returns the character following point in the buffer. | 92 This function returns the character following point in the buffer. |
103 This is similar to @code{(char-after (point))}. However, if point is at | 93 This is similar to @code{(char-after (point))}. However, if point is at |
1486 Alphabetical sorting means that two sort keys are compared by | 1476 Alphabetical sorting means that two sort keys are compared by |
1487 comparing the first characters of each, the second characters of each, | 1477 comparing the first characters of each, the second characters of each, |
1488 and so on. If a mismatch is found, it means that the sort keys are | 1478 and so on. If a mismatch is found, it means that the sort keys are |
1489 unequal; the sort key whose character is less at the point of first | 1479 unequal; the sort key whose character is less at the point of first |
1490 mismatch is the lesser sort key. The individual characters are compared | 1480 mismatch is the lesser sort key. The individual characters are compared |
1491 according to their numerical values. Since Emacs uses the @sc{ascii} | 1481 according to their numerical values. Since Emacs uses the @sc{ASCII} |
1492 character set, the ordering in that set determines alphabetical order. | 1482 character set, the ordering in that set determines alphabetical order. |
1493 @c version 19 change | 1483 @c version 19 change |
1494 | 1484 |
1495 The value of the @var{record-regexp} argument specifies how to divide | 1485 The value of the @var{record-regexp} argument specifies how to divide |
1496 the buffer into sort records. At the end of each record, a search is | 1486 the buffer into sort records. At the end of each record, a search is |
2472 @end example | 2462 @end example |
2473 @end defun | 2463 @end defun |
2474 | 2464 |
2475 @defun translate-region start end table | 2465 @defun translate-region start end table |
2476 This function applies a translation table to the characters in the | 2466 This function applies a translation table to the characters in the |
2477 buffer between positions @var{start} and @var{end}. The translation | 2467 buffer between positions @var{start} and @var{end}. |
2478 table @var{table} can be either a string, a vector, or a char-table. | 2468 |
2479 | 2469 The translation table @var{table} is a string; @code{(aref @var{table} |
2480 If @var{table} is a string, its @var{n}th element is the mapping for the | 2470 @var{ochar})} gives the translated character corresponding to |
2481 character with code @var{n}. | 2471 @var{ochar}. If the length of @var{table} is less than 256, any |
2482 | 2472 characters with codes larger than the length of @var{table} are not |
2483 If @var{table} is a vector, its @var{n}th element is the mapping for | 2473 altered by the translation. |
2484 character with code @var{n}. Legal mappings are characters, strings, or | |
2485 @code{nil} (meaning don't replace.) | |
2486 | |
2487 If @var{table} is a char-table, its elements describe the mapping | |
2488 between characters and their replacements. The char-table should be of | |
2489 type @code{char} or @code{generic}. | |
2490 | |
2491 When the @var{table} is a string or vector and its length is less than | |
2492 the total number of characters (256 without Mule), any characters with | |
2493 codes larger than the length of @var{table} are not altered by the | |
2494 translation. | |
2495 | 2474 |
2496 The return value of @code{translate-region} is the number of | 2475 The return value of @code{translate-region} is the number of |
2497 characters that were actually changed by the translation. This does | 2476 characters that were actually changed by the translation. This does |
2498 not count characters that were mapped into themselves in the | 2477 not count characters that were mapped into themselves in the |
2499 translation table. | 2478 translation table. |
2500 | |
2501 @strong{NOTE}: Prior to XEmacs 21.2, the @var{table} argument was | |
2502 allowed only to be a string. This is still the case in FSF Emacs. | |
2503 | |
2504 The following example creates a char-table that is passed to | |
2505 @code{translate-region}, which translates character @samp{a} to | |
2506 @samp{the letter a}, removes character @samp{b}, and translates | |
2507 character @samp{c} to newline. | |
2508 | |
2509 @example | |
2510 @group | |
2511 ---------- Buffer: foo ---------- | |
2512 Here is a sentence in the buffer. | |
2513 ---------- Buffer: foo ---------- | |
2514 @end group | |
2515 | |
2516 @group | |
2517 (let ((table (make-char-table 'generic))) | |
2518 (put-char-table ?a "the letter a" table) | |
2519 (put-char-table ?b "" table) | |
2520 (put-char-table ?c ?\n table) | |
2521 (translate-region (point-min) (point-max) table)) | |
2522 @result{} 3 | |
2523 | |
2524 ---------- Buffer: foo ---------- | |
2525 Here is the letter a senten | |
2526 e in the uffer. | |
2527 ---------- Buffer: foo ---------- | |
2528 @end group | |
2529 @end example | |
2530 @end defun | 2479 @end defun |
2531 | 2480 |
2532 @node Registers | 2481 @node Registers |
2533 @section Registers | 2482 @section Registers |
2534 @cindex registers | 2483 @cindex registers |