diff options
| author | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
| commit | 476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch) | |
| tree | 4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /lispref | |
| parent | a13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff) | |
| parent | 6b519504c3297595101628e823e72c91e562ab45 (diff) | |
| download | emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.zip | |
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-294
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-295
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-296
Update from CVS: admin/FOR-RELEASE: Update refcard section.
* emacs@sv.gnu.org/emacs--devo--0--patch-297
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-298
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-299
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-300
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-301
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-302
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-303
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-304
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-103
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-104
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/ChangeLog | 138 | ||||
| -rw-r--r-- | lispref/commands.texi | 2 | ||||
| -rw-r--r-- | lispref/compile.texi | 5 | ||||
| -rw-r--r-- | lispref/display.texi | 406 | ||||
| -rw-r--r-- | lispref/elisp.texi | 4 | ||||
| -rw-r--r-- | lispref/files.texi | 18 | ||||
| -rw-r--r-- | lispref/help.texi | 2 | ||||
| -rw-r--r-- | lispref/internals.texi | 7 | ||||
| -rw-r--r-- | lispref/keymaps.texi | 117 | ||||
| -rw-r--r-- | lispref/minibuf.texi | 13 | ||||
| -rw-r--r-- | lispref/modes.texi | 10 | ||||
| -rw-r--r-- | lispref/nonascii.texi | 20 | ||||
| -rw-r--r-- | lispref/objects.texi | 13 | ||||
| -rw-r--r-- | lispref/processes.texi | 70 | ||||
| -rw-r--r-- | lispref/text.texi | 3 | ||||
| -rw-r--r-- | lispref/tips.texi | 54 | ||||
| -rw-r--r-- | lispref/windows.texi | 18 |
17 files changed, 746 insertions, 154 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index de08e3fb459..85ceb0dd700 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,139 @@ | |||
| 1 | 2006-06-10 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * tips.texi (Coding Conventions): Add `@end itemize'. | ||
| 4 | |||
| 5 | 2006-06-10 Richard Stallman <rms@gnu.org> | ||
| 6 | |||
| 7 | * tips.texi (Coding Conventions): Explain use of coding systems | ||
| 8 | to ensure one decoding for strings. | ||
| 9 | |||
| 10 | 2006-06-09 Aidan Kehoe <kehoea@parhasard.net> | ||
| 11 | |||
| 12 | * objects.texi (Character Type): Describe the\uABCD and \U00ABCDEF | ||
| 13 | syntax. | ||
| 14 | |||
| 15 | 2006-06-07 Eli Zaretskii <eliz@gnu.org> | ||
| 16 | |||
| 17 | * display.texi (Font Selection): Remove description of | ||
| 18 | clear-face-cache. | ||
| 19 | |||
| 20 | * compile.texi (Eval During Compile): Fix a typo. Add index | ||
| 21 | entries for possible uses of eval-when-compile. | ||
| 22 | |||
| 23 | 2006-06-04 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 24 | |||
| 25 | * display.texi (Abstract Display): Fix typo. | ||
| 26 | |||
| 27 | 2006-06-03 Eli Zaretskii <eliz@gnu.org> | ||
| 28 | |||
| 29 | * minibuf.texi (Minibuffer History) <history-add-new-input>: | ||
| 30 | Reword variable's description. | ||
| 31 | |||
| 32 | 2006-06-01 Richard Stallman <rms@gnu.org> | ||
| 33 | |||
| 34 | * windows.texi (Splitting Windows): Clarify splitting nonselected | ||
| 35 | window. | ||
| 36 | |||
| 37 | 2006-05-31 Juri Linkov <juri@jurta.org> | ||
| 38 | |||
| 39 | * minibuf.texi (Minibuffer History): Add history-add-new-input. | ||
| 40 | |||
| 41 | 2006-05-30 Richard Stallman <rms@gnu.org> | ||
| 42 | |||
| 43 | * display.texi (Line Height): Fix errors in description of | ||
| 44 | default line height and line-height properyty. | ||
| 45 | |||
| 46 | * nonascii.texi (Default Coding Systems): Further clarification. | ||
| 47 | |||
| 48 | 2006-05-29 Luc Teirlinck <teirllm@auburn.edu> | ||
| 49 | |||
| 50 | * internals.texi (Pure Storage): Mention that an overflow in pure | ||
| 51 | space causes a memory leak. | ||
| 52 | (Garbage Collection): If there was an overflow in pure space, | ||
| 53 | `garbage-collect' returns nil. | ||
| 54 | |||
| 55 | 2006-05-30 Eli Zaretskii <eliz@gnu.org> | ||
| 56 | |||
| 57 | * nonascii.texi (Default Coding Systems): Fix it some more. | ||
| 58 | |||
| 59 | 2006-05-29 Eli Zaretskii <eliz@gnu.org> | ||
| 60 | |||
| 61 | * nonascii.texi (Default Coding Systems): Fix last change. | ||
| 62 | |||
| 63 | 2006-05-29 Kenichi Handa <handa@m17n.org> | ||
| 64 | |||
| 65 | * nonascii.texi (find-operation-coding-system): Describe the new | ||
| 66 | argument format (FILENAME . BUFFER). | ||
| 67 | |||
| 68 | 2006-05-28 Richard Stallman <rms@gnu.org> | ||
| 69 | |||
| 70 | * tips.texi (Coding Conventions): Better explain reasons not to | ||
| 71 | advise other packages or use `eval-after-load'. | ||
| 72 | |||
| 73 | 2006-05-29 Kim F. Storm <storm@cua.dk> | ||
| 74 | |||
| 75 | * processes.texi (Bindat Functions): Rename `pos' and `raw-data' to | ||
| 76 | `bindat-idx' and `bindat-raw' for clarity. | ||
| 77 | |||
| 78 | 2006-05-27 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 79 | |||
| 80 | * processes.texi (Bindat Spec): Expand on `repeat' handler. | ||
| 81 | |||
| 82 | * display.texi (Display): Add "Abstract Display" to menu. | ||
| 83 | (Abstract Display, Abstract Display Functions) | ||
| 84 | (Abstract Display Example): New nodes. | ||
| 85 | * elisp.texi (Top): Add "Abstract Display" to menu. | ||
| 86 | |||
| 87 | 2006-05-27 Chong Yidong <cyd@stupidchicken.com> | ||
| 88 | |||
| 89 | * keymaps.texi (Key Sequences): Link to input events definition. | ||
| 90 | (Format of Keymaps): Delete material duplicated in Keymap Basics. | ||
| 91 | |||
| 92 | * files.texi (Changing Files): Document updated argument list for | ||
| 93 | copy-file. | ||
| 94 | |||
| 95 | 2006-05-27 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 96 | |||
| 97 | * processes.texi (Bindat Functions): Explain term "total length". | ||
| 98 | Use it in bindat-length and bindat-pack descriptions. | ||
| 99 | |||
| 100 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> | ||
| 101 | |||
| 102 | * tips.texi (Coding Conventions): Advise against using | ||
| 103 | eval-after-load in packages. Add an index entry. | ||
| 104 | |||
| 105 | 2006-05-25 Juri Linkov <juri@jurta.org> | ||
| 106 | |||
| 107 | * minibuf.texi (Text from Minibuffer): Undocument keep-all. | ||
| 108 | |||
| 109 | * modes.texi (%-Constructs): Add %e, %z, %Z. | ||
| 110 | |||
| 111 | 2006-05-25 Richard Stallman <rms@gnu.org> | ||
| 112 | |||
| 113 | * elisp.texi (Top): Update subnode menu. | ||
| 114 | |||
| 115 | * keymaps.texi (Keymap Basics): New node, split out of Key Sequences. | ||
| 116 | (Keymaps): Update menu. | ||
| 117 | |||
| 118 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 119 | |||
| 120 | * keymaps.texi (Key Sequences): Some clarifications. | ||
| 121 | |||
| 122 | 2006-05-25 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 123 | |||
| 124 | * processes.texi (Bindat Functions): Say "unibyte string" | ||
| 125 | explicitly for bindat-unpack and bindat-pack descriptions. | ||
| 126 | (Bindat Examples): Don't call `string-make-unibyte' in example. | ||
| 127 | |||
| 128 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 129 | |||
| 130 | * keymaps.texi (Key Sequences): Renamed from Keymap Terminology. | ||
| 131 | Explain string and vector representations of key sequences | ||
| 132 | |||
| 133 | * keymaps.texi (Changing Key Bindings): | ||
| 134 | * commands.texi (Interactive Codes, Interactive Codes): | ||
| 135 | * help.texi (Describing Characters): Refer to it. | ||
| 136 | |||
| 1 | 2006-05-23 Luc Teirlinck <teirllm@auburn.edu> | 137 | 2006-05-23 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 138 | ||
| 3 | * frames.texi (Pointer Shape): @end table -> @end defvar. | 139 | * frames.texi (Pointer Shape): @end table -> @end defvar. |
| @@ -509,7 +645,7 @@ | |||
| 509 | 645 | ||
| 510 | 2005-12-23 Eli Zaretskii <eliz@gnu.org> | 646 | 2005-12-23 Eli Zaretskii <eliz@gnu.org> |
| 511 | 647 | ||
| 512 | * text.texi (Undo): Remove dupliate descriptions of `apply | 648 | * text.texi (Undo): Remove duplicate descriptions of `apply |
| 513 | funname' and `apply delta' elements of the undo list. | 649 | funname' and `apply delta' elements of the undo list. |
| 514 | 650 | ||
| 515 | 2005-12-20 Richard M. Stallman <rms@gnu.org> | 651 | 2005-12-20 Richard M. Stallman <rms@gnu.org> |
diff --git a/lispref/commands.texi b/lispref/commands.texi index fa5d95f0408..0723c368bba 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -362,7 +362,7 @@ An irrelevant argument. This code always supplies @code{nil} as | |||
| 362 | the argument's value. No I/O. | 362 | the argument's value. No I/O. |
| 363 | 363 | ||
| 364 | @item k | 364 | @item k |
| 365 | A key sequence (@pxref{Keymap Terminology}). This keeps reading events | 365 | A key sequence (@pxref{Key Sequences}). This keeps reading events |
| 366 | until a command (or undefined command) is found in the current key | 366 | until a command (or undefined command) is found in the current key |
| 367 | maps. The key sequence argument is represented as a string or vector. | 367 | maps. The key sequence argument is represented as a string or vector. |
| 368 | The cursor does not move into the echo area. Prompt. | 368 | The cursor does not move into the echo area. Prompt. |
diff --git a/lispref/compile.texi b/lispref/compile.texi index 4b796697731..1b18e0ee284 100644 --- a/lispref/compile.texi +++ b/lispref/compile.texi | |||
| @@ -435,15 +435,16 @@ compiler becomes a constant which appears in the compiled program. If | |||
| 435 | you load the source file, rather than compiling it, @var{body} is | 435 | you load the source file, rather than compiling it, @var{body} is |
| 436 | evaluated normally. | 436 | evaluated normally. |
| 437 | 437 | ||
| 438 | @cindex compile-time constant | ||
| 438 | If you have a constant that needs some calculation to produce, | 439 | If you have a constant that needs some calculation to produce, |
| 439 | @code{eval-when-compile} can do that done at compile-time. For | 440 | @code{eval-when-compile} can do that at compile-time. For example, |
| 440 | example, | ||
| 441 | 441 | ||
| 442 | @lisp | 442 | @lisp |
| 443 | (defvar my-regexp | 443 | (defvar my-regexp |
| 444 | (eval-when-compile (regexp-opt '("aaa" "aba" "abb")))) | 444 | (eval-when-compile (regexp-opt '("aaa" "aba" "abb")))) |
| 445 | @end lisp | 445 | @end lisp |
| 446 | 446 | ||
| 447 | @cindex macros, at compile time | ||
| 447 | If you're using another package, but only need macros from it (the | 448 | If you're using another package, but only need macros from it (the |
| 448 | byte compiler will expand those), then @code{eval-when-compile} can be | 449 | byte compiler will expand those), then @code{eval-when-compile} can be |
| 449 | used to load it for compiling, but not executing. For example, | 450 | used to load it for compiling, but not executing. For example, |
diff --git a/lispref/display.texi b/lispref/display.texi index a77c895276e..1b8e66ec23e 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -29,6 +29,7 @@ that Emacs presents to the user. | |||
| 29 | * Display Property:: Enabling special display features. | 29 | * Display Property:: Enabling special display features. |
| 30 | * Images:: Displaying images in Emacs buffers. | 30 | * Images:: Displaying images in Emacs buffers. |
| 31 | * Buttons:: Adding clickable buttons to Emacs buffers. | 31 | * Buttons:: Adding clickable buttons to Emacs buffers. |
| 32 | * Abstract Display:: Emacs' Widget for Object Collections. | ||
| 32 | * Blinking:: How Emacs shows the matching open parenthesis. | 33 | * Blinking:: How Emacs shows the matching open parenthesis. |
| 33 | * Usual Display:: The usual conventions for displaying nonprinting chars. | 34 | * Usual Display:: The usual conventions for displaying nonprinting chars. |
| 34 | * Display Tables:: How to specify other conventions. | 35 | * Display Tables:: How to specify other conventions. |
| @@ -1581,41 +1582,41 @@ equal to or less than the display width of @var{ellipsis}. If | |||
| 1581 | @cindex line height | 1582 | @cindex line height |
| 1582 | 1583 | ||
| 1583 | The total height of each display line consists of the height of the | 1584 | The total height of each display line consists of the height of the |
| 1584 | contents of the line, and additional vertical line spacing below the | 1585 | contents of the line, plus optional additional vertical line spacing |
| 1585 | display row. | 1586 | above or below the display line. |
| 1586 | 1587 | ||
| 1587 | The height of the line contents is normally determined from the | 1588 | The height of the line contents is the maximum height of any |
| 1588 | maximum height of any character or image on that display line, | 1589 | character or image on that display line, including the final newline |
| 1589 | including the final newline if there is one. (A line that is | 1590 | if there is one. (A display line that is continued doesn't include a |
| 1590 | continued doesn't include a final newline.) In the most common case, | 1591 | final newline.) That is the default line height, if you do nothing to |
| 1591 | the line height equals the height of the default frame font. | 1592 | specify a greater height. (In the most common case, this equals the |
| 1593 | height of the default frame font.) | ||
| 1592 | 1594 | ||
| 1593 | There are several ways to explicitly control or change the line | 1595 | There are several ways to explicitly specify a larger line height, |
| 1594 | height, either by specifying an absolute height for the display line, | 1596 | either by specifying an absolute height for the display line, or by |
| 1595 | or by adding additional vertical space below one or all lines. | 1597 | specifying vertical space. However, no matter what you specify, the |
| 1598 | actual line height can never be less than the default. | ||
| 1596 | 1599 | ||
| 1597 | @kindex line-height @r{(text property)} | 1600 | @kindex line-height @r{(text property)} |
| 1598 | A newline can have a @code{line-height} text or overlay property | 1601 | A newline can have a @code{line-height} text or overlay property |
| 1599 | that controls the total height of the display line ending in that | 1602 | that controls the total height of the display line ending in that |
| 1600 | newline. | 1603 | newline. |
| 1601 | 1604 | ||
| 1602 | If the property value is a list @code{(@var{height} @var{total})}, | 1605 | If the property value is @code{t}, the newline character has no |
| 1603 | then @var{height} is used as the actual property value for the | 1606 | effect on the displayed height of the line---the visible contents |
| 1604 | @code{line-height}, and @var{total} specifies the total displayed | 1607 | alone determine the height. This is useful for tiling small images |
| 1605 | height of the line, so the line spacing added below the line equals | 1608 | (or image slices) without adding blank areas between the images. |
| 1606 | the @var{total} height minus the actual line height. In this case, | ||
| 1607 | the other ways to specify the line spacing are ignored. | ||
| 1608 | 1609 | ||
| 1609 | If the property value is @code{t}, the displayed height of the | 1610 | If the property value is a list of the form @code{(@var{height} |
| 1610 | line is exactly what its contents demand; no line-spacing is added. | 1611 | @var{total})}, that adds extra space @emph{below} the display line. |
| 1611 | This case is useful for tiling small images or image slices without | 1612 | First Emacs uses @var{height} as a height spec to control extra space |
| 1612 | adding blank areas between the images. | 1613 | @emph{above} the line; then it adds enough space @emph{below} the line |
| 1614 | to bring the total line height up to @var{total}. In this case, the | ||
| 1615 | other ways to specify the line spacing are ignored. | ||
| 1613 | 1616 | ||
| 1614 | If the property value is not @code{t}, it is a height spec. A height | 1617 | Any other kind of property value is a height spec, which translates |
| 1615 | spec stands for a numeric height value; this height spec specifies the | 1618 | into a number---the specified line height. There are several ways to |
| 1616 | actual line height, @var{line-height}. There are several ways to | 1619 | write a height spec; here's how each of them translates into a number: |
| 1617 | write a height spec; here's how each of them translates into a numeric | ||
| 1618 | height: | ||
| 1619 | 1620 | ||
| 1620 | @table @code | 1621 | @table @code |
| 1621 | @item @var{integer} | 1622 | @item @var{integer} |
| @@ -1633,11 +1634,10 @@ If the height spec is a cons of the format shown, the numeric height | |||
| 1633 | is @var{ratio} times the height of the contents of the line. | 1634 | is @var{ratio} times the height of the contents of the line. |
| 1634 | @end table | 1635 | @end table |
| 1635 | 1636 | ||
| 1636 | Thus, any valid non-@code{t} property value specifies a height in pixels, | 1637 | Thus, any valid height spec determines the height in pixels, one way |
| 1637 | @var{line-height}, one way or another. If the line contents' height | 1638 | or another. If the line contents' height is less than that, Emacs |
| 1638 | is less than @var{line-height}, Emacs adds extra vertical space above | 1639 | adds extra vertical space above the line to achieve the specified |
| 1639 | the line to achieve the total height @var{line-height}. Otherwise, | 1640 | total height. |
| 1640 | @var{line-height} has no effect. | ||
| 1641 | 1641 | ||
| 1642 | If you don't specify the @code{line-height} property, the line's | 1642 | If you don't specify the @code{line-height} property, the line's |
| 1643 | height consists of the contents' height plus the line spacing. | 1643 | height consists of the contents' height plus the line spacing. |
| @@ -1662,9 +1662,9 @@ height. This overrides line spacings specified for the frame. | |||
| 1662 | 1662 | ||
| 1663 | @kindex line-spacing @r{(text property)} | 1663 | @kindex line-spacing @r{(text property)} |
| 1664 | Finally, a newline can have a @code{line-spacing} text or overlay | 1664 | Finally, a newline can have a @code{line-spacing} text or overlay |
| 1665 | property that controls the height of the display line ending with that | 1665 | property that overrides the default frame line spacing and the buffer |
| 1666 | newline. The property value overrides the default frame line spacing | 1666 | local @code{line-spacing} variable, for the display line ending in |
| 1667 | and the buffer local @code{line-spacing} variable. | 1667 | that newline. |
| 1668 | 1668 | ||
| 1669 | One way or another, these mechanisms specify a Lisp value for the | 1669 | One way or another, these mechanisms specify a Lisp value for the |
| 1670 | spacing of each line. The value is a height spec, and it translates | 1670 | spacing of each line. The value is a height spec, and it translates |
| @@ -2381,13 +2381,6 @@ expression in the list. For example, | |||
| 2381 | allows the use of scalable fonts with registry @code{muleindian-2}. | 2381 | allows the use of scalable fonts with registry @code{muleindian-2}. |
| 2382 | @end defvar | 2382 | @end defvar |
| 2383 | 2383 | ||
| 2384 | @defun clear-face-cache &optional unload-p | ||
| 2385 | @tindex clear-face-cache | ||
| 2386 | This function clears the face cache for all frames. | ||
| 2387 | If @var{unload-p} is non-@code{nil}, that means to unload | ||
| 2388 | all unused fonts as well. | ||
| 2389 | @end defun | ||
| 2390 | |||
| 2391 | @defvar face-font-rescale-alist | 2384 | @defvar face-font-rescale-alist |
| 2392 | This variable specifies scaling for certain faces. Its value should | 2385 | This variable specifies scaling for certain faces. Its value should |
| 2393 | be a list of elements of the form | 2386 | be a list of elements of the form |
| @@ -4621,6 +4614,339 @@ buffer. If @var{count-current} is non-@code{nil}, count any button at | |||
| 4621 | @var{pos} in the search, instead of starting at the next button. | 4614 | @var{pos} in the search, instead of starting at the next button. |
| 4622 | @end defun | 4615 | @end defun |
| 4623 | 4616 | ||
| 4617 | @node Abstract Display | ||
| 4618 | @section Abstract Display | ||
| 4619 | @cindex ewoc | ||
| 4620 | @cindex display, abstract | ||
| 4621 | @cindex display, arbitrary objects | ||
| 4622 | @cindex model/view/controller | ||
| 4623 | @cindex view part, model/view/controller | ||
| 4624 | |||
| 4625 | The Ewoc package constructs buffer text that represents a structure | ||
| 4626 | of Lisp objects, and updates the text to follow changes in that | ||
| 4627 | structure. This is like the ``view'' component in the | ||
| 4628 | ``model/view/controller'' design paradigm. | ||
| 4629 | |||
| 4630 | An @dfn{ewoc} is a structure that organizes information required to | ||
| 4631 | construct buffer text that represents certain Lisp data. The buffer | ||
| 4632 | text of the ewoc has three parts, in order: first, fixed @dfn{header} | ||
| 4633 | text; next, textual descriptions of a series of data elements (Lisp | ||
| 4634 | objects that you specify); and last, fixed @dfn{footer} text. | ||
| 4635 | Specifically, an ewoc contains information on: | ||
| 4636 | |||
| 4637 | @itemize @bullet | ||
| 4638 | @item | ||
| 4639 | The buffer which its text is generated in. | ||
| 4640 | |||
| 4641 | @item | ||
| 4642 | The text's start position in the buffer. | ||
| 4643 | |||
| 4644 | @item | ||
| 4645 | The header and footer strings. | ||
| 4646 | |||
| 4647 | @item | ||
| 4648 | A doubly-linked chain of @dfn{nodes}, each of which contains: | ||
| 4649 | |||
| 4650 | @itemize | ||
| 4651 | @item | ||
| 4652 | A @dfn{data element}, a single Lisp object. | ||
| 4653 | |||
| 4654 | @item | ||
| 4655 | Links to the preceding and following nodes in the chain. | ||
| 4656 | @end itemize | ||
| 4657 | |||
| 4658 | @item | ||
| 4659 | A @dfn{pretty-printer} function which is responsible for | ||
| 4660 | inserting the textual representation of a data | ||
| 4661 | element value into the current buffer. | ||
| 4662 | @end itemize | ||
| 4663 | |||
| 4664 | Typically, you define an ewoc with @code{ewoc-create}, and then pass | ||
| 4665 | the resulting ewoc structure to other functions in the Ewoc package to | ||
| 4666 | build nodes within it, and display it in the buffer. Once it is | ||
| 4667 | displayed in the buffer, other functions determine the correspondance | ||
| 4668 | between buffer positions and nodes, move point from one node's textual | ||
| 4669 | representation to another, and so forth. @xref{Abstract Display | ||
| 4670 | Functions}. | ||
| 4671 | |||
| 4672 | A node @dfn{encapsulates} a data element much the way a variable | ||
| 4673 | holds a value. Normally, encapsulation occurs as a part of adding a | ||
| 4674 | node to the ewoc. You can retrieve the data element value and place a | ||
| 4675 | new value in its place, like so: | ||
| 4676 | |||
| 4677 | @lisp | ||
| 4678 | (ewoc-data @var{node}) | ||
| 4679 | @result{} value | ||
| 4680 | |||
| 4681 | (ewoc-set-data @var{node} @var{new-value}) | ||
| 4682 | @result{} @var{new-value} | ||
| 4683 | @end lisp | ||
| 4684 | |||
| 4685 | @noindent | ||
| 4686 | You can also use, as the data element value, a Lisp object (list or | ||
| 4687 | vector) that is a container for the ``real'' value, or an index into | ||
| 4688 | some other structure. The example (@pxref{Abstract Display Example}) | ||
| 4689 | uses the latter approach. | ||
| 4690 | |||
| 4691 | When the data changes, you will want to update the text in the | ||
| 4692 | buffer. You can update all nodes by calling @code{ewoc-refresh}, or | ||
| 4693 | just specific nodes using @code{ewoc-invalidate}, or all nodes | ||
| 4694 | satisfying a predicate using @code{ewoc-map}. Alternatively, you can | ||
| 4695 | delete invalid nodes using @code{ewoc-delete} or @code{ewoc-filter}, | ||
| 4696 | and add new nodes in their place. Deleting a node from an ewoc deletes | ||
| 4697 | its associated textual description from buffer, as well. | ||
| 4698 | |||
| 4699 | @menu | ||
| 4700 | * Abstract Display Functions:: | ||
| 4701 | * Abstract Display Example:: | ||
| 4702 | @end menu | ||
| 4703 | |||
| 4704 | @node Abstract Display Functions | ||
| 4705 | @subsection Abstract Display Functions | ||
| 4706 | |||
| 4707 | In this subsection, @var{ewoc} and @var{node} stand for the | ||
| 4708 | structures described above (@pxref{Abstract Display}), while | ||
| 4709 | @var{data} stands for an arbitrary Lisp object used as a data element. | ||
| 4710 | |||
| 4711 | @defun ewoc-create pretty-printer &optional header footer nosep | ||
| 4712 | This constructs and returns a new ewoc, with no nodes (and thus no data | ||
| 4713 | elements). @var{pretty-printer} should be a function that takes one | ||
| 4714 | argument, a data element of the sort you plan to use in this ewoc, and | ||
| 4715 | inserts its textual description at point using @code{insert} (and never | ||
| 4716 | @code{insert-before-markers}, because that would interfere with the | ||
| 4717 | Ewoc package's internal mechanisms). | ||
| 4718 | |||
| 4719 | Normally, a newline is automatically inserted after the header, | ||
| 4720 | the footer and every node's textual description. If @var{nosep} | ||
| 4721 | is non-@code{nil}, no newline is inserted. This may be useful for | ||
| 4722 | displaying an entire ewoc on a single line, for example, or for | ||
| 4723 | making nodes ``invisible'' by arranging for @var{pretty-printer} | ||
| 4724 | to do nothing for those nodes. | ||
| 4725 | |||
| 4726 | An ewoc maintains its text in the buffer that is current when | ||
| 4727 | you create it, so switch to the intended buffer before calling | ||
| 4728 | @code{ewoc-create}. | ||
| 4729 | @end defun | ||
| 4730 | |||
| 4731 | @defun ewoc-buffer ewoc | ||
| 4732 | This returns the buffer where @var{ewoc} maintains its text. | ||
| 4733 | @end defun | ||
| 4734 | |||
| 4735 | @defun ewoc-get-hf ewoc | ||
| 4736 | This returns a cons cell @code{(@var{header} . @var{footer})} | ||
| 4737 | made from @var{ewoc}'s header and footer. | ||
| 4738 | @end defun | ||
| 4739 | |||
| 4740 | @defun ewoc-set-hf ewoc header footer | ||
| 4741 | This sets the header and footer of @var{ewoc} to the strings | ||
| 4742 | @var{header} and @var{footer}, respectively. | ||
| 4743 | @end defun | ||
| 4744 | |||
| 4745 | @defun ewoc-enter-first ewoc data | ||
| 4746 | @defunx ewoc-enter-last ewoc data | ||
| 4747 | These add a new node encapsulating @var{data}, putting it, respectively, | ||
| 4748 | at the beginning or end of @var{ewoc}'s chain of nodes. | ||
| 4749 | @end defun | ||
| 4750 | |||
| 4751 | @defun ewoc-enter-before ewoc node data | ||
| 4752 | @defunx ewoc-enter-after ewoc node data | ||
| 4753 | These add a new node encapsulating @var{data}, adding it to | ||
| 4754 | @var{ewoc} before or after @var{node}, respectively. | ||
| 4755 | @end defun | ||
| 4756 | |||
| 4757 | @defun ewoc-prev ewoc node | ||
| 4758 | @defunx ewoc-next ewoc node | ||
| 4759 | These return, respectively, the previous node and the next node of @var{node} | ||
| 4760 | in @var{ewoc}. | ||
| 4761 | @end defun | ||
| 4762 | |||
| 4763 | @defun ewoc-nth ewoc n | ||
| 4764 | This returns the node in @var{ewoc} found at zero-based index @var{n}. | ||
| 4765 | A negative @var{n} means count from the end. @code{ewoc-nth} returns | ||
| 4766 | @code{nil} if @var{n} is out of range. | ||
| 4767 | @end defun | ||
| 4768 | |||
| 4769 | @defun ewoc-data node | ||
| 4770 | This extracts the data encapsulated by @var{node} and returns it. | ||
| 4771 | @end defun | ||
| 4772 | |||
| 4773 | @defun ewoc-set-data node data | ||
| 4774 | This sets the data encapsulated by @var{node} to @var{data}. | ||
| 4775 | @end defun | ||
| 4776 | |||
| 4777 | @defun ewoc-locate ewoc &optional pos guess | ||
| 4778 | This determines the node in @var{ewoc} which contains point (or | ||
| 4779 | @var{pos} if specified), and returns that node. If @var{ewoc} has no | ||
| 4780 | nodes, it returns @code{nil}. If @var{pos} is before the first node, | ||
| 4781 | it returns the first node; if @var{pos} is after the last node, it returns | ||
| 4782 | the last node. The optional third arg @var{guess} | ||
| 4783 | should be a node that is likely to be near @var{pos}; this doesn't | ||
| 4784 | alter the result, but makes the function run faster. | ||
| 4785 | @end defun | ||
| 4786 | |||
| 4787 | @defun ewoc-location node | ||
| 4788 | This returns the start position of @var{node}. | ||
| 4789 | @end defun | ||
| 4790 | |||
| 4791 | @defun ewoc-goto-prev ewoc arg | ||
| 4792 | @defunx ewoc-goto-next ewoc arg | ||
| 4793 | These move point to the previous or next, respectively, @var{arg}th node | ||
| 4794 | in @var{ewoc}. @code{ewoc-goto-prev} does not move if it is already at | ||
| 4795 | the first node or if @var{ewoc} is empty, whereas @code{ewoc-goto-next} | ||
| 4796 | moves past the last node, returning @code{nil}. Excepting this special | ||
| 4797 | case, these functions return the node moved to. | ||
| 4798 | @end defun | ||
| 4799 | |||
| 4800 | @defun ewoc-goto-node ewoc node | ||
| 4801 | This moves point to the start of @var{node} in @var{ewoc}. | ||
| 4802 | @end defun | ||
| 4803 | |||
| 4804 | @defun ewoc-refresh ewoc | ||
| 4805 | This function regenerates the text of @var{ewoc}. It works by | ||
| 4806 | deleting the text between the header and the footer, i.e., all the | ||
| 4807 | data elements' representations, and then calling the pretty-printer | ||
| 4808 | function for each node, one by one, in order. | ||
| 4809 | @end defun | ||
| 4810 | |||
| 4811 | @defun ewoc-invalidate ewoc &rest nodes | ||
| 4812 | This is similar to @code{ewoc-refresh}, except that only @var{nodes} in | ||
| 4813 | @var{ewoc} are updated instead of the entire set. | ||
| 4814 | @end defun | ||
| 4815 | |||
| 4816 | @defun ewoc-delete ewoc &rest nodes | ||
| 4817 | This deletes each node in @var{nodes} from @var{ewoc}. | ||
| 4818 | @end defun | ||
| 4819 | |||
| 4820 | @defun ewoc-filter ewoc predicate &rest args | ||
| 4821 | This calls @var{predicate} for each data element in @var{ewoc} and | ||
| 4822 | deletes those nodes for which @var{predicate} returns @code{nil}. | ||
| 4823 | Any @var{args} are passed to @var{predicate}. | ||
| 4824 | @end defun | ||
| 4825 | |||
| 4826 | @defun ewoc-collect ewoc predicate &rest args | ||
| 4827 | This calls @var{predicate} for each data element in @var{ewoc} | ||
| 4828 | and returns a list of those elements for which @var{predicate} | ||
| 4829 | returns non-@code{nil}. The elements in the list are ordered | ||
| 4830 | as in the buffer. Any @var{args} are passed to @var{predicate}. | ||
| 4831 | @end defun | ||
| 4832 | |||
| 4833 | @defun ewoc-map map-function ewoc &rest args | ||
| 4834 | This calls @var{map-function} for each data element in @var{ewoc} and | ||
| 4835 | updates those nodes for which @var{map-function} returns non-@code{nil}. | ||
| 4836 | Any @var{args} are passed to @var{map-function}. | ||
| 4837 | @end defun | ||
| 4838 | |||
| 4839 | @node Abstract Display Example | ||
| 4840 | @subsection Abstract Display Example | ||
| 4841 | |||
| 4842 | Here is a simple example using functions of the ewoc package to | ||
| 4843 | implement a ``color components display'', an area in a buffer that | ||
| 4844 | represents a vector of three integers (itself representing a 24-bit RGB | ||
| 4845 | value) in various ways. | ||
| 4846 | |||
| 4847 | @example | ||
| 4848 | (setq colorcomp-ewoc nil | ||
| 4849 | colorcomp-data nil | ||
| 4850 | colorcomp-mode-map nil | ||
| 4851 | colorcomp-labels ["Red" "Green" "Blue"]) | ||
| 4852 | |||
| 4853 | (defun colorcomp-pp (data) | ||
| 4854 | (if data | ||
| 4855 | (let ((comp (aref colorcomp-data data))) | ||
| 4856 | (insert (aref colorcomp-labels data) "\t: #x" | ||
| 4857 | (format "%02X" comp) " " | ||
| 4858 | (make-string (ash comp -2) ?#) "\n")) | ||
| 4859 | (let ((cstr (format "#%02X%02X%02X" | ||
| 4860 | (aref colorcomp-data 0) | ||
| 4861 | (aref colorcomp-data 1) | ||
| 4862 | (aref colorcomp-data 2))) | ||
| 4863 | (samp " (sample text) ")) | ||
| 4864 | (insert "Color\t: " | ||
| 4865 | (propertize samp 'face `(foreground-color . ,cstr)) | ||
| 4866 | (propertize samp 'face `(background-color . ,cstr)) | ||
| 4867 | "\n")))) | ||
| 4868 | |||
| 4869 | (defun colorcomp (color) | ||
| 4870 | "Allow fiddling with COLOR in a new buffer. | ||
| 4871 | The buffer is in Color Components mode." | ||
| 4872 | (interactive "sColor (name or #RGB or #RRGGBB): ") | ||
| 4873 | (when (string= "" color) | ||
| 4874 | (setq color "green")) | ||
| 4875 | (unless (color-values color) | ||
| 4876 | (error "No such color: %S" color)) | ||
| 4877 | (switch-to-buffer | ||
| 4878 | (generate-new-buffer (format "originally: %s" color))) | ||
| 4879 | (kill-all-local-variables) | ||
| 4880 | (setq major-mode 'colorcomp-mode | ||
| 4881 | mode-name "Color Components") | ||
| 4882 | (use-local-map colorcomp-mode-map) | ||
| 4883 | (erase-buffer) | ||
| 4884 | (buffer-disable-undo) | ||
| 4885 | (let ((data (apply 'vector (mapcar (lambda (n) (ash n -8)) | ||
| 4886 | (color-values color)))) | ||
| 4887 | (ewoc (ewoc-create 'colorcomp-pp | ||
| 4888 | "\nColor Components\n\n" | ||
| 4889 | (substitute-command-keys | ||
| 4890 | "\n\\@{colorcomp-mode-map@}")))) | ||
| 4891 | (set (make-local-variable 'colorcomp-data) data) | ||
| 4892 | (set (make-local-variable 'colorcomp-ewoc) ewoc) | ||
| 4893 | (ewoc-enter-last ewoc 0) | ||
| 4894 | (ewoc-enter-last ewoc 1) | ||
| 4895 | (ewoc-enter-last ewoc 2) | ||
| 4896 | (ewoc-enter-last ewoc nil))) | ||
| 4897 | @end example | ||
| 4898 | |||
| 4899 | @cindex controller part, model/view/controller | ||
| 4900 | This example can be extended to be a ``color selection widget'' (in | ||
| 4901 | other words, the controller part of the ``model/view/controller'' | ||
| 4902 | design paradigm) by defining commands to modify @code{colorcomp-data} | ||
| 4903 | and to ``finish'' the selection process, and a keymap to tie it all | ||
| 4904 | together conveniently. | ||
| 4905 | |||
| 4906 | @example | ||
| 4907 | (defun colorcomp-mod (index limit delta) | ||
| 4908 | (let ((cur (aref colorcomp-data index))) | ||
| 4909 | (unless (= limit cur) | ||
| 4910 | (aset colorcomp-data index (+ cur delta))) | ||
| 4911 | (ewoc-invalidate | ||
| 4912 | colorcomp-ewoc | ||
| 4913 | (ewoc-nth colorcomp-ewoc index) | ||
| 4914 | (ewoc-nth colorcomp-ewoc -1)))) | ||
| 4915 | |||
| 4916 | (defun colorcomp-R-more () (interactive) (colorcomp-mod 0 255 1)) | ||
| 4917 | (defun colorcomp-G-more () (interactive) (colorcomp-mod 1 255 1)) | ||
| 4918 | (defun colorcomp-B-more () (interactive) (colorcomp-mod 2 255 1)) | ||
| 4919 | (defun colorcomp-R-less () (interactive) (colorcomp-mod 0 0 -1)) | ||
| 4920 | (defun colorcomp-G-less () (interactive) (colorcomp-mod 1 0 -1)) | ||
| 4921 | (defun colorcomp-B-less () (interactive) (colorcomp-mod 2 0 -1)) | ||
| 4922 | |||
| 4923 | (defun colorcomp-copy-as-kill-and-exit () | ||
| 4924 | "Copy the color components into the kill ring and kill the buffer. | ||
| 4925 | The string is formatted #RRGGBB (hash followed by six hex digits)." | ||
| 4926 | (interactive) | ||
| 4927 | (kill-new (format "#%02X%02X%02X" | ||
| 4928 | (aref colorcomp-data 0) | ||
| 4929 | (aref colorcomp-data 1) | ||
| 4930 | (aref colorcomp-data 2))) | ||
| 4931 | (kill-buffer nil)) | ||
| 4932 | |||
| 4933 | (setq colorcomp-mode-map | ||
| 4934 | (let ((m (make-sparse-keymap))) | ||
| 4935 | (suppress-keymap m) | ||
| 4936 | (define-key m "i" 'colorcomp-R-less) | ||
| 4937 | (define-key m "o" 'colorcomp-R-more) | ||
| 4938 | (define-key m "k" 'colorcomp-G-less) | ||
| 4939 | (define-key m "l" 'colorcomp-G-more) | ||
| 4940 | (define-key m "," 'colorcomp-B-less) | ||
| 4941 | (define-key m "." 'colorcomp-B-more) | ||
| 4942 | (define-key m " " 'colorcomp-copy-as-kill-and-exit) | ||
| 4943 | m)) | ||
| 4944 | @end example | ||
| 4945 | |||
| 4946 | Note that we never modify the data in each node, which is fixed when the | ||
| 4947 | ewoc is created to be either @code{nil} or an index into the vector | ||
| 4948 | @code{colorcomp-data}, the actual color components. | ||
| 4949 | |||
| 4624 | @node Blinking | 4950 | @node Blinking |
| 4625 | @section Blinking Parentheses | 4951 | @section Blinking Parentheses |
| 4626 | @cindex parenthesis matching | 4952 | @cindex parenthesis matching |
diff --git a/lispref/elisp.texi b/lispref/elisp.texi index 7d7bfa0ab6e..5d667c0fd14 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi | |||
| @@ -590,7 +590,8 @@ Defining Commands | |||
| 590 | 590 | ||
| 591 | Keymaps | 591 | Keymaps |
| 592 | 592 | ||
| 593 | * Keymap Terminology:: Definitions of terms pertaining to keymaps. | 593 | * Key Sequences:: Key sequences as Lisp objects. |
| 594 | * Keymap Basics:: Basic concepts of keymaps. | ||
| 594 | * Format of Keymaps:: What a keymap looks like as a Lisp object. | 595 | * Format of Keymaps:: What a keymap looks like as a Lisp object. |
| 595 | * Creating Keymaps:: Functions to create and copy keymaps. | 596 | * Creating Keymaps:: Functions to create and copy keymaps. |
| 596 | * Inheritance and Keymaps:: How one keymap can inherit the bindings | 597 | * Inheritance and Keymaps:: How one keymap can inherit the bindings |
| @@ -1006,6 +1007,7 @@ Emacs Display | |||
| 1006 | * Display Property:: Enabling special display features. | 1007 | * Display Property:: Enabling special display features. |
| 1007 | * Images:: Displaying images in Emacs buffers. | 1008 | * Images:: Displaying images in Emacs buffers. |
| 1008 | * Buttons:: Adding clickable buttons to Emacs buffers. | 1009 | * Buttons:: Adding clickable buttons to Emacs buffers. |
| 1010 | * Abstract Display:: Emacs' Widget for Object Collections. | ||
| 1009 | * Blinking:: How Emacs shows the matching open parenthesis. | 1011 | * Blinking:: How Emacs shows the matching open parenthesis. |
| 1010 | * Usual Display:: The usual conventions for displaying nonprinting chars. | 1012 | * Usual Display:: The usual conventions for displaying nonprinting chars. |
| 1011 | * Display Tables:: How to specify other conventions. | 1013 | * Display Tables:: How to specify other conventions. |
diff --git a/lispref/files.texi b/lispref/files.texi index 0d944771a2e..f7af725f191 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -1431,7 +1431,7 @@ with @code{add-name-to-file} and then deleting @var{filename} has the | |||
| 1431 | same effect as renaming, aside from momentary intermediate states. | 1431 | same effect as renaming, aside from momentary intermediate states. |
| 1432 | @end deffn | 1432 | @end deffn |
| 1433 | 1433 | ||
| 1434 | @deffn Command copy-file oldname newname &optional ok-if-exists time mustbenew | 1434 | @deffn Command copy-file oldname newname &optional ok-if-exists time preserve-uid-gid |
| 1435 | This command copies the file @var{oldname} to @var{newname}. An | 1435 | This command copies the file @var{oldname} to @var{newname}. An |
| 1436 | error is signaled if @var{oldname} does not exist. If @var{newname} | 1436 | error is signaled if @var{oldname} does not exist. If @var{newname} |
| 1437 | names a directory, it copies @var{oldname} into that directory, | 1437 | names a directory, it copies @var{oldname} into that directory, |
| @@ -1440,16 +1440,18 @@ preserving its final name component. | |||
| 1440 | If @var{time} is non-@code{nil}, then this function gives the new file | 1440 | If @var{time} is non-@code{nil}, then this function gives the new file |
| 1441 | the same last-modified time that the old one has. (This works on only | 1441 | the same last-modified time that the old one has. (This works on only |
| 1442 | some operating systems.) If setting the time gets an error, | 1442 | some operating systems.) If setting the time gets an error, |
| 1443 | @code{copy-file} signals a @code{file-date-error} error. | 1443 | @code{copy-file} signals a @code{file-date-error} error. In an |
| 1444 | interactive call, a prefix argument specifies a non-@code{nil} value | ||
| 1445 | for @var{time}. | ||
| 1444 | 1446 | ||
| 1445 | This function copies the file modes, too. | 1447 | This function copies the file modes, too. |
| 1446 | 1448 | ||
| 1447 | In an interactive call, a prefix argument specifies a non-@code{nil} | 1449 | If argument @var{preserve-uid-gid} is @code{nil}, we let the operating |
| 1448 | value for @var{time}. | 1450 | system decide the user and group ownership of the new file (this is |
| 1449 | 1451 | usually set to the user running Emacs). If @var{preserve-uid-gid} is | |
| 1450 | The argument @var{mustbenew} controls whether an existing file can be | 1452 | non-@code{nil}, we attempt to copy the user and group ownership of the |
| 1451 | overwritten. It works like the similarly-named argument of | 1453 | file. This works only on some operating systems, and only if you have |
| 1452 | @code{write-region} (@pxref{Writing to Files, mustbenew}). | 1454 | the correct permissions to do so. |
| 1453 | @end deffn | 1455 | @end deffn |
| 1454 | 1456 | ||
| 1455 | @deffn Command make-symbolic-link filename newname &optional ok-if-exists | 1457 | @deffn Command make-symbolic-link filename newname &optional ok-if-exists |
diff --git a/lispref/help.texi b/lispref/help.texi index 0fe996dfd7c..6173c746d1e 100644 --- a/lispref/help.texi +++ b/lispref/help.texi | |||
| @@ -497,7 +497,7 @@ can also be used as a rough inverse for @code{key-description}. You | |||
| 497 | call it with a string containing key descriptions, separated by spaces; | 497 | call it with a string containing key descriptions, separated by spaces; |
| 498 | it returns a string or vector containing the corresponding events. | 498 | it returns a string or vector containing the corresponding events. |
| 499 | (This may or may not be a single valid key sequence, depending on what | 499 | (This may or may not be a single valid key sequence, depending on what |
| 500 | events you use; @pxref{Keymap Terminology}.) If @var{need-vector} is | 500 | events you use; @pxref{Key Sequences}.) If @var{need-vector} is |
| 501 | non-@code{nil}, the return value is always a vector. | 501 | non-@code{nil}, the return value is always a vector. |
| 502 | @end defun | 502 | @end defun |
| 503 | 503 | ||
diff --git a/lispref/internals.texi b/lispref/internals.texi index bc35e215574..fa96687d1d8 100644 --- a/lispref/internals.texi +++ b/lispref/internals.texi | |||
| @@ -160,7 +160,8 @@ the preloaded libraries, @file{temacs} allocates dynamic memory for | |||
| 160 | the part that didn't fit. If that happens, you should increase the | 160 | the part that didn't fit. If that happens, you should increase the |
| 161 | compilation parameter @code{PURESIZE} in the file | 161 | compilation parameter @code{PURESIZE} in the file |
| 162 | @file{src/puresize.h} and rebuild Emacs, even though the resulting | 162 | @file{src/puresize.h} and rebuild Emacs, even though the resulting |
| 163 | image will work. Such an overflow normally won't happen unless you | 163 | image will work: garbage collection is disabled in this situation, |
| 164 | causing a memory leak. Such an overflow normally won't happen unless you | ||
| 164 | try to preload additional libraries or add features to the standard | 165 | try to preload additional libraries or add features to the standard |
| 165 | ones. Emacs will display a warning about the overflow when it | 166 | ones. Emacs will display a warning about the overflow when it |
| 166 | starts. | 167 | starts. |
| @@ -348,6 +349,10 @@ operating system, but which are currently not in use. (A string | |||
| 348 | object consists of a header and the storage for the string text | 349 | object consists of a header and the storage for the string text |
| 349 | itself; the latter is only allocated when the string is created.) | 350 | itself; the latter is only allocated when the string is created.) |
| 350 | @end table | 351 | @end table |
| 352 | |||
| 353 | If there was overflow in pure space (see the previous section), | ||
| 354 | @code{garbage-collect} returns @code{nil}, because a real garbage | ||
| 355 | collection can not be done in this situation. | ||
| 351 | @end deffn | 356 | @end deffn |
| 352 | 357 | ||
| 353 | @defopt garbage-collection-messages | 358 | @defopt garbage-collection-messages |
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 39a57eddf13..f6779b247d0 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi | |||
| @@ -16,7 +16,8 @@ to look up the next input event; this continues until a command is | |||
| 16 | found. The whole process is called @dfn{key lookup}. | 16 | found. The whole process is called @dfn{key lookup}. |
| 17 | 17 | ||
| 18 | @menu | 18 | @menu |
| 19 | * Keymap Terminology:: Definitions of terms pertaining to keymaps. | 19 | * Key Sequences:: Key sequences as Lisp objects. |
| 20 | * Keymap Basics:: Basic concepts of keymaps. | ||
| 20 | * Format of Keymaps:: What a keymap looks like as a Lisp object. | 21 | * Format of Keymaps:: What a keymap looks like as a Lisp object. |
| 21 | * Creating Keymaps:: Functions to create and copy keymaps. | 22 | * Creating Keymaps:: Functions to create and copy keymaps. |
| 22 | * Inheritance and Keymaps:: How one keymap can inherit the bindings | 23 | * Inheritance and Keymaps:: How one keymap can inherit the bindings |
| @@ -37,32 +38,80 @@ found. The whole process is called @dfn{key lookup}. | |||
| 37 | * Menu Keymaps:: Defining a menu as a keymap. | 38 | * Menu Keymaps:: Defining a menu as a keymap. |
| 38 | @end menu | 39 | @end menu |
| 39 | 40 | ||
| 40 | @node Keymap Terminology | 41 | @node Key Sequences |
| 41 | @section Keymap Terminology | 42 | @section Key Sequences |
| 42 | @cindex key | 43 | @cindex key |
| 43 | @cindex keystroke | 44 | @cindex keystroke |
| 45 | @cindex key sequence | ||
| 46 | |||
| 47 | A @dfn{key sequence}, or @dfn{key} for short, is a sequence of one | ||
| 48 | or more input events that form a unit. Input events include | ||
| 49 | characters, function keys, and mouse actions (@pxref{Input Events}). | ||
| 50 | The Emacs Lisp representation for a key sequence is a string or | ||
| 51 | vector. Unless otherwise stated, any Emacs Lisp function that accepts | ||
| 52 | a key sequence as an argument can handle both representations. | ||
| 53 | |||
| 54 | In the string representation, alphanumeric characters ordinarily | ||
| 55 | stand for themselves; for example, @code{"a"} represents @kbd{a} and | ||
| 56 | and @code{"2"} represents @kbd{2}. Control character events are | ||
| 57 | prefixed by the substring @code{"\C-"}, and meta characters by | ||
| 58 | @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. | ||
| 59 | In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events | ||
| 60 | are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and | ||
| 61 | @code{"\d"} respectively. The string representation of a complete key | ||
| 62 | sequence is the concatenation of the string representations of the | ||
| 63 | constituent events; thus, @code{"\C-xl"} represents the key sequence | ||
| 64 | @kbd{C-x l}. | ||
| 65 | |||
| 66 | Key sequences containing function keys, mouse button events, or | ||
| 67 | non-ASCII characters such as @kbd{C-=} or @kbd{H-a} cannot be | ||
| 68 | represented as strings; they have to be represented as vectors. | ||
| 69 | |||
| 70 | In the vector representation, each element of the vector represents | ||
| 71 | an input event, in its Lisp form. @xref{Input Events}. For example, | ||
| 72 | the vector @code{[?\C-x ?l]} represents the key sequence @kbd{C-x l}. | ||
| 73 | |||
| 74 | For examples of key sequences written in string and vector | ||
| 75 | representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}. | ||
| 76 | |||
| 77 | @defmac kbd keyseq-text | ||
| 78 | This macro converts the text @var{keyseq-text} (a string constant) | ||
| 79 | into a key sequence (a string or vector constant). The contents of | ||
| 80 | @var{keyseq-text} should describe the key sequence using almost the same | ||
| 81 | syntax used in this manual. More precisely, it uses the same syntax | ||
| 82 | that Edit Macro mode uses for editing keyboard macros (@pxref{Edit | ||
| 83 | Keyboard Macro,,, emacs, The GNU Emacs Manual}); you must surround | ||
| 84 | function key names with @samp{<@dots{}>}. | ||
| 85 | |||
| 86 | @example | ||
| 87 | (kbd "C-x") @result{} "\C-x" | ||
| 88 | (kbd "C-x C-f") @result{} "\C-x\C-f" | ||
| 89 | (kbd "C-x 4 C-f") @result{} "\C-x4\C-f" | ||
| 90 | (kbd "X") @result{} "X" | ||
| 91 | (kbd "RET") @result{} "\^M" | ||
| 92 | (kbd "C-c SPC") @result{} "\C-c@ " | ||
| 93 | (kbd "<f1> SPC") @result{} [f1 32] | ||
| 94 | (kbd "C-M-<down>") @result{} [C-M-down] | ||
| 95 | @end example | ||
| 96 | @end defmac | ||
| 97 | |||
| 98 | @node Keymap Basics | ||
| 99 | @section Keymap Basics | ||
| 44 | @cindex key binding | 100 | @cindex key binding |
| 45 | @cindex binding of a key | 101 | @cindex binding of a key |
| 46 | @cindex complete key | 102 | @cindex complete key |
| 47 | @cindex undefined key | 103 | @cindex undefined key |
| 48 | 104 | ||
| 49 | A @dfn{keymap} is a table mapping event types to definitions (which | 105 | A keymap is a Lisp data structure that specifies @dfn{key bindings} |
| 50 | can be any Lisp objects, though only certain types are meaningful for | 106 | for various key sequences. |
| 51 | execution by the command loop). Given an event (or an event type) and a | ||
| 52 | keymap, Emacs can get the event's definition. Events include | ||
| 53 | characters, function keys, and mouse actions (@pxref{Input Events}). | ||
| 54 | |||
| 55 | A sequence of input events that form a unit is called a | ||
| 56 | @dfn{key sequence}, or @dfn{key} for short. A sequence of one event | ||
| 57 | is always a key sequence, and so are some multi-event sequences. | ||
| 58 | 107 | ||
| 59 | A keymap determines a binding or definition for any key sequence. If | 108 | A single keymap directly specifies definitions for individual |
| 60 | the key sequence is a single event, its binding is the definition of the | 109 | events. When a key sequence consists of a single event, its binding |
| 61 | event in the keymap. The binding of a key sequence of more than one | 110 | in a keymap is the keymap's definition for that event. The binding of |
| 62 | event is found by an iterative process: the binding of the first event | 111 | a longer key sequence is found by an iterative process: first find the |
| 63 | is found, and must be a keymap; then the second event's binding is found | 112 | definition of the first event (which must itself be a keymap); then |
| 64 | in that keymap, and so on until all the events in the key sequence are | 113 | find the second event's definition in that keymap, and so on until all |
| 65 | used up. | 114 | the events in the key sequence have been processed. |
| 66 | 115 | ||
| 67 | If the binding of a key sequence is a keymap, we call the key sequence | 116 | If the binding of a key sequence is a keymap, we call the key sequence |
| 68 | a @dfn{prefix key}. Otherwise, we call it a @dfn{complete key} (because | 117 | a @dfn{prefix key}. Otherwise, we call it a @dfn{complete key} (because |
| @@ -98,30 +147,6 @@ precedence over) the corresponding global bindings. The minor mode | |||
| 98 | keymaps shadow both local and global keymaps. @xref{Active Keymaps}, | 147 | keymaps shadow both local and global keymaps. @xref{Active Keymaps}, |
| 99 | for details. | 148 | for details. |
| 100 | 149 | ||
| 101 | The Emacs Lisp representation for a key sequence is a string or vector. | ||
| 102 | You can enter key sequence constants using the ordinary string or vector | ||
| 103 | representation; it is also convenient to use @code{kbd}: | ||
| 104 | |||
| 105 | @defmac kbd keyseq-text | ||
| 106 | This macro converts the text @var{keyseq-text} (a string constant) | ||
| 107 | into a key sequence (a string or vector constant). The contents | ||
| 108 | of @var{keyseq-text} should describe the key sequence using the syntax | ||
| 109 | used in this manual. More precisely, it uses the same syntax that | ||
| 110 | Edit Macro mode uses for editing keyboard macros (@pxref{Edit Keyboard | ||
| 111 | Macro,,, emacs, The GNU Emacs Manual}). | ||
| 112 | |||
| 113 | @example | ||
| 114 | (kbd "C-x") @result{} "\C-x" | ||
| 115 | (kbd "C-x C-f") @result{} "\C-x\C-f" | ||
| 116 | (kbd "C-x 4 C-f") @result{} "\C-x4\C-f" | ||
| 117 | (kbd "X") @result{} "X" | ||
| 118 | (kbd "RET") @result{} "\^M" | ||
| 119 | (kbd "C-c SPC") @result{} "\C-c@ " | ||
| 120 | (kbd "<f1> SPC") @result{} [f1 32] | ||
| 121 | (kbd "C-M-<down>") @result{} [C-M-down] | ||
| 122 | @end example | ||
| 123 | @end defmac | ||
| 124 | |||
| 125 | @node Format of Keymaps | 150 | @node Format of Keymaps |
| 126 | @section Format of Keymaps | 151 | @section Format of Keymaps |
| 127 | @cindex format of keymaps | 152 | @cindex format of keymaps |
| @@ -129,7 +154,7 @@ Macro,,, emacs, The GNU Emacs Manual}). | |||
| 129 | @cindex full keymap | 154 | @cindex full keymap |
| 130 | @cindex sparse keymap | 155 | @cindex sparse keymap |
| 131 | 156 | ||
| 132 | A keymap is a list whose @sc{car} is the symbol @code{keymap}. The | 157 | Each keymap is a list whose @sc{car} is the symbol @code{keymap}. The |
| 133 | remaining elements of the list define the key bindings of the keymap. | 158 | remaining elements of the list define the key bindings of the keymap. |
| 134 | A symbol whose function definition is a keymap is also a keymap. Use | 159 | A symbol whose function definition is a keymap is also a keymap. Use |
| 135 | the function @code{keymapp} (see below) to test whether an object is a | 160 | the function @code{keymapp} (see below) to test whether an object is a |
| @@ -1197,8 +1222,8 @@ numeric codes for the modifier bits don't appear in compiled files. | |||
| 1197 | For the functions below, an error is signaled if @var{keymap} is not | 1222 | For the functions below, an error is signaled if @var{keymap} is not |
| 1198 | a keymap or if @var{key} is not a string or vector representing a key | 1223 | a keymap or if @var{key} is not a string or vector representing a key |
| 1199 | sequence. You can use event types (symbols) as shorthand for events | 1224 | sequence. You can use event types (symbols) as shorthand for events |
| 1200 | that are lists. The @code{kbd} macro (@pxref{Keymap Terminology}) is | 1225 | that are lists. The @code{kbd} macro (@pxref{Key Sequences}) is a |
| 1201 | a convenient way to specify the key sequence. | 1226 | convenient way to specify the key sequence. |
| 1202 | 1227 | ||
| 1203 | @defun define-key keymap key binding | 1228 | @defun define-key keymap key binding |
| 1204 | This function sets the binding for @var{key} in @var{keymap}. (If | 1229 | This function sets the binding for @var{key} in @var{keymap}. (If |
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index f69cf03deac..20a049f037b 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi | |||
| @@ -110,7 +110,7 @@ middle of a Lisp function. Instead, do all minibuffer input as part of | |||
| 110 | reading the arguments for a command, in the @code{interactive} | 110 | reading the arguments for a command, in the @code{interactive} |
| 111 | specification. @xref{Defining Commands}. | 111 | specification. @xref{Defining Commands}. |
| 112 | 112 | ||
| 113 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method keep-all | 113 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method |
| 114 | This function is the most general way to get input through the | 114 | This function is the most general way to get input through the |
| 115 | minibuffer. By default, it accepts arbitrary text and returns it as a | 115 | minibuffer. By default, it accepts arbitrary text and returns it as a |
| 116 | string; however, if @var{read} is non-@code{nil}, then it uses | 116 | string; however, if @var{read} is non-@code{nil}, then it uses |
| @@ -162,9 +162,6 @@ the setting of @code{enable-multibyte-characters} (@pxref{Text | |||
| 162 | Representations}) from whichever buffer was current before entering the | 162 | Representations}) from whichever buffer was current before entering the |
| 163 | minibuffer. | 163 | minibuffer. |
| 164 | 164 | ||
| 165 | If @var{keep-all} is non-@code{nil}, even empty and duplicate inputs | ||
| 166 | are added to the history list. | ||
| 167 | |||
| 168 | Use of @var{initial-contents} is mostly deprecated; we recommend using | 165 | Use of @var{initial-contents} is mostly deprecated; we recommend using |
| 169 | a non-@code{nil} value only in conjunction with specifying a cons cell | 166 | a non-@code{nil} value only in conjunction with specifying a cons cell |
| 170 | for @var{hist}. @xref{Initial Input}. | 167 | for @var{hist}. @xref{Initial Input}. |
| @@ -463,6 +460,14 @@ However, if @var{keep-all} is non-@code{nil}, that says not to remove | |||
| 463 | duplicates, and to add @var{newelt} to the list even if it is empty. | 460 | duplicates, and to add @var{newelt} to the list even if it is empty. |
| 464 | @end defun | 461 | @end defun |
| 465 | 462 | ||
| 463 | @defvar history-add-new-input | ||
| 464 | If the value of this variable is @code{nil}, standard functions that | ||
| 465 | read from the minibuffer don't add new elements to the history list. | ||
| 466 | This lets Lisp programs explicitly manage input history by using | ||
| 467 | @code{add-to-history}. By default, @code{history-add-new-input} is | ||
| 468 | set to a non-@code{nil} value. | ||
| 469 | @end defvar | ||
| 470 | |||
| 466 | @defvar history-length | 471 | @defvar history-length |
| 467 | The value of this variable specifies the maximum length for all | 472 | The value of this variable specifies the maximum length for all |
| 468 | history lists that don't specify their own maximum lengths. If the | 473 | history lists that don't specify their own maximum lengths. If the |
diff --git a/lispref/modes.texi b/lispref/modes.texi index 9e55ca847fc..7c4896d9532 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -1927,6 +1927,10 @@ The current buffer name, obtained with the @code{buffer-name} function. | |||
| 1927 | @item %c | 1927 | @item %c |
| 1928 | The current column number of point. | 1928 | The current column number of point. |
| 1929 | 1929 | ||
| 1930 | @item %e | ||
| 1931 | When Emacs is nearly out of memory for Lisp objects, a brief message | ||
| 1932 | saying so. Otherwise, this is empty. | ||
| 1933 | |||
| 1930 | @item %f | 1934 | @item %f |
| 1931 | The visited file name, obtained with the @code{buffer-file-name} | 1935 | The visited file name, obtained with the @code{buffer-file-name} |
| 1932 | function. @xref{Buffer File Name}. | 1936 | function. @xref{Buffer File Name}. |
| @@ -1972,6 +1976,12 @@ Whether the visited file is a text file or a binary file. This is a | |||
| 1972 | meaningful distinction only on certain operating systems (@pxref{MS-DOS | 1976 | meaningful distinction only on certain operating systems (@pxref{MS-DOS |
| 1973 | File Types}). | 1977 | File Types}). |
| 1974 | 1978 | ||
| 1979 | @item %z | ||
| 1980 | The mnemonics of buffer, terminal, and keyboard coding systems. | ||
| 1981 | |||
| 1982 | @item %Z | ||
| 1983 | Like @samp{%z}, but including the end-of-line format. | ||
| 1984 | |||
| 1975 | @item %* | 1985 | @item %* |
| 1976 | @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* | 1986 | @samp{%} if the buffer is read only (see @code{buffer-read-only}); @* |
| 1977 | @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* | 1987 | @samp{*} if the buffer is modified (see @code{buffer-modified-p}); @* |
diff --git a/lispref/nonascii.texi b/lispref/nonascii.texi index 0f4a70404af..2224fdbd436 100644 --- a/lispref/nonascii.texi +++ b/lispref/nonascii.texi | |||
| @@ -1103,11 +1103,11 @@ The argument @var{operation} should be a symbol, any one of | |||
| 1103 | @code{insert-file-contents}, @code{write-region}, | 1103 | @code{insert-file-contents}, @code{write-region}, |
| 1104 | @code{start-process}, @code{call-process}, @code{call-process-region}, | 1104 | @code{start-process}, @code{call-process}, @code{call-process-region}, |
| 1105 | or @code{open-network-stream}. These are the names of the Emacs I/O | 1105 | or @code{open-network-stream}. These are the names of the Emacs I/O |
| 1106 | primitives that can do coding system conversion. | 1106 | primitives that can do character code and eol conversion. |
| 1107 | 1107 | ||
| 1108 | The remaining arguments should be the same arguments that might be given | 1108 | The remaining arguments should be the same arguments that might be given |
| 1109 | to that I/O primitive. Depending on the primitive, one of those | 1109 | to the corresponding I/O primitive. Depending on the primitive, one |
| 1110 | arguments is selected as the @dfn{target}. For example, if | 1110 | of those arguments is selected as the @dfn{target}. For example, if |
| 1111 | @var{operation} does file I/O, whichever argument specifies the file | 1111 | @var{operation} does file I/O, whichever argument specifies the file |
| 1112 | name is the target. For subprocess primitives, the process name is the | 1112 | name is the target. For subprocess primitives, the process name is the |
| 1113 | target. For @code{open-network-stream}, the target is the service name | 1113 | target. For @code{open-network-stream}, the target is the service name |
| @@ -1115,7 +1115,19 @@ or port number. | |||
| 1115 | 1115 | ||
| 1116 | Depending on @var{operation}, this function looks up the target in | 1116 | Depending on @var{operation}, this function looks up the target in |
| 1117 | @code{file-coding-system-alist}, @code{process-coding-system-alist}, | 1117 | @code{file-coding-system-alist}, @code{process-coding-system-alist}, |
| 1118 | or @code{network-coding-system-alist}. | 1118 | or @code{network-coding-system-alist}. If the target is found in the |
| 1119 | alist, @code{find-operation-coding-system} returns its association in | ||
| 1120 | the alist; otherwise it returns @code{nil}. | ||
| 1121 | |||
| 1122 | If @var{operation} is @code{insert-file-contents}, the argument | ||
| 1123 | corresponding to the target may be a cons cell of the form | ||
| 1124 | @code{(@var{filename} . @var{buffer})}). In that case, @var{filename} | ||
| 1125 | is a file name to look up in @code{file-coding-system-alist}, and | ||
| 1126 | @var{buffer} is a buffer that contains the file's contents (not yet | ||
| 1127 | decoded). If @code{file-coding-system-alist} specifies a function to | ||
| 1128 | call for this file, and that function needs to examine the file's | ||
| 1129 | contents (as it usually does), it should examine the contents of | ||
| 1130 | @var{buffer} instead of reading the file. | ||
| 1119 | @end defun | 1131 | @end defun |
| 1120 | 1132 | ||
| 1121 | @node Specifying Coding Systems | 1133 | @node Specifying Coding Systems |
diff --git a/lispref/objects.texi b/lispref/objects.texi index 5665e5beee6..688fd0be398 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi | |||
| @@ -431,6 +431,19 @@ Numerically, the | |||
| 431 | bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper. | 431 | bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper. |
| 432 | @end ifnottex | 432 | @end ifnottex |
| 433 | 433 | ||
| 434 | @cindex unicode character escape | ||
| 435 | Emacs provides a syntax for specifying characters by their Unicode | ||
| 436 | code points. @code{?\u@var{nnnn}} represents a character that maps to | ||
| 437 | the Unicode code point @samp{U+@var{nnnn}}. There is a slightly | ||
| 438 | different syntax for specifying characters with code points above | ||
| 439 | @code{#xFFFF}; @code{\U00@var{nnnnnn}} represents the character whose | ||
| 440 | Unicode code point is @samp{U+@var{nnnnnn}}, if such a character | ||
| 441 | is supported by Emacs. | ||
| 442 | |||
| 443 | Unlike in some other programming languages, in Emacs Lisp this | ||
| 444 | syntax is available for character literals, and (see later) in | ||
| 445 | strings, but not elsewhere. | ||
| 446 | |||
| 434 | @cindex @samp{\} in character constant | 447 | @cindex @samp{\} in character constant |
| 435 | @cindex backslash in character constant | 448 | @cindex backslash in character constant |
| 436 | @cindex octal character code | 449 | @cindex octal character code |
diff --git a/lispref/processes.texi b/lispref/processes.texi index 9eb733236a9..0f0b617e36c 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -2185,11 +2185,11 @@ field name is specified, the value is bound to that field name. | |||
| 2185 | @var{form} can access and update these dynamically bound variables: | 2185 | @var{form} can access and update these dynamically bound variables: |
| 2186 | 2186 | ||
| 2187 | @table @code | 2187 | @table @code |
| 2188 | @item raw-data | 2188 | @item bindat-raw |
| 2189 | The data as a byte array. | 2189 | The data as a byte array. |
| 2190 | 2190 | ||
| 2191 | @item pos | 2191 | @item bindat-idx |
| 2192 | Current position of the unpacking or packing operation. | 2192 | Current index into bindat-raw of the unpacking or packing operation. |
| 2193 | 2193 | ||
| 2194 | @item struct | 2194 | @item struct |
| 2195 | Alist. | 2195 | Alist. |
| @@ -2231,23 +2231,26 @@ of @var{form}. A non-@code{nil} result indicates a match. | |||
| 2231 | @end itemize | 2231 | @end itemize |
| 2232 | 2232 | ||
| 2233 | @item repeat @var{count} @var{field-spec}@dots{} | 2233 | @item repeat @var{count} @var{field-spec}@dots{} |
| 2234 | Process the set of @var{field-spec}s recursively, in order, and loop | ||
| 2235 | starting from the first one, for @var{count} times overall (looping | ||
| 2236 | @code{@var{count} @minus{} 1} times). | ||
| 2234 | @var{count} may be an integer, or a list of one element naming a | 2237 | @var{count} may be an integer, or a list of one element naming a |
| 2235 | previous field. For correct operation, each @var{field-spec} must | 2238 | previous field. For correct operation, each @var{field-spec} must |
| 2236 | include a name. | 2239 | include a name. |
| 2237 | @c ??? What does it MEAN? | ||
| 2238 | @end table | 2240 | @end table |
| 2239 | 2241 | ||
| 2240 | @node Bindat Functions | 2242 | @node Bindat Functions |
| 2241 | @subsection Functions to Unpack and Pack Bytes | 2243 | @subsection Functions to Unpack and Pack Bytes |
| 2242 | 2244 | ||
| 2243 | In the following documentation, @var{spec} refers to a data layout | 2245 | In the following documentation, @var{spec} refers to a data layout |
| 2244 | specification, @code{raw-data} to a byte array, and @var{struct} to an | 2246 | specification, @code{bindat-raw} to a byte array, and @var{struct} to an |
| 2245 | alist representing unpacked field data. | 2247 | alist representing unpacked field data. |
| 2246 | 2248 | ||
| 2247 | @defun bindat-unpack spec raw-data &optional pos | 2249 | @defun bindat-unpack spec bindat-raw &optional bindat-idx |
| 2248 | This function unpacks data from the byte array @code{raw-data} | 2250 | This function unpacks data from the unibyte string or byte |
| 2251 | array @code{bindat-raw} | ||
| 2249 | according to @var{spec}. Normally this starts unpacking at the | 2252 | according to @var{spec}. Normally this starts unpacking at the |
| 2250 | beginning of the byte array, but if @var{pos} is non-@code{nil}, it | 2253 | beginning of the byte array, but if @var{bindat-idx} is non-@code{nil}, it |
| 2251 | specifies a zero-based starting position to use instead. | 2254 | specifies a zero-based starting position to use instead. |
| 2252 | 2255 | ||
| 2253 | The value is an alist or nested alist in which each element describes | 2256 | The value is an alist or nested alist in which each element describes |
| @@ -2267,23 +2270,29 @@ field @code{c} in the third element of subfield @code{b} of field | |||
| 2267 | @code{a}. (This corresponds to @code{struct.a.b[2].c} in C.) | 2270 | @code{a}. (This corresponds to @code{struct.a.b[2].c} in C.) |
| 2268 | @end defun | 2271 | @end defun |
| 2269 | 2272 | ||
| 2273 | Although packing and unpacking operations change the organization of | ||
| 2274 | data (in memory), they preserve the data's @dfn{total length}, which is | ||
| 2275 | the sum of all the fields' lengths, in bytes. This value is not | ||
| 2276 | generally inherent in either the specification or alist alone; instead, | ||
| 2277 | both pieces of information contribute to its calculation. Likewise, the | ||
| 2278 | length of a string or array being unpacked may be longer than the data's | ||
| 2279 | total length as described by the specification. | ||
| 2280 | |||
| 2270 | @defun bindat-length spec struct | 2281 | @defun bindat-length spec struct |
| 2271 | @c ??? I don't understand this at all -- rms | 2282 | This function returns the total length of the data in @var{struct}, |
| 2272 | This function returns the length in bytes of @var{struct}, according | 2283 | according to @var{spec}. |
| 2273 | to @var{spec}. | ||
| 2274 | @end defun | 2284 | @end defun |
| 2275 | 2285 | ||
| 2276 | @defun bindat-pack spec struct &optional raw-data pos | 2286 | @defun bindat-pack spec struct &optional bindat-raw bindat-idx |
| 2277 | This function returns a byte array packed according to @var{spec} from | 2287 | This function returns a byte array packed according to @var{spec} from |
| 2278 | the data in the alist @var{struct}. Normally it creates and fills a | 2288 | the data in the alist @var{struct}. Normally it creates and fills a |
| 2279 | new byte array starting at the beginning. However, if @var{raw-data} | 2289 | new byte array starting at the beginning. However, if @var{bindat-raw} |
| 2280 | is non-@code{nil}, it specifies a pre-allocated string or vector to | 2290 | is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to |
| 2281 | pack into. If @var{pos} is non-@code{nil}, it specifies the starting | 2291 | pack into. If @var{bindat-idx} is non-@code{nil}, it specifies the starting |
| 2282 | offset for packing into @code{raw-data}. | 2292 | offset for packing into @code{bindat-raw}. |
| 2283 | 2293 | ||
| 2284 | @c ??? Isn't this a bug? Shouldn't it always be unibyte? | 2294 | When pre-allocating, you should make sure @code{(length @var{bindat-raw})} |
| 2285 | Note: The result is a multibyte string; use @code{string-make-unibyte} | 2295 | meets or exceeds the total length to avoid an out-of-range error. |
| 2286 | on it to make it unibyte if necessary. | ||
| 2287 | @end defun | 2296 | @end defun |
| 2288 | 2297 | ||
| 2289 | @defun bindat-ip-to-string ip | 2298 | @defun bindat-ip-to-string ip |
| @@ -2367,18 +2376,17 @@ COOKIES, indicates the border between entries." | |||
| 2367 | (with-temp-buffer | 2376 | (with-temp-buffer |
| 2368 | (set-buffer-multibyte nil) | 2377 | (set-buffer-multibyte nil) |
| 2369 | (insert | 2378 | (insert |
| 2370 | (string-make-unibyte | 2379 | (bindat-pack |
| 2371 | (bindat-pack | 2380 | fcookie-index-spec |
| 2372 | fcookie-index-spec | 2381 | `((:version . 2) |
| 2373 | `((:version . 2) | 2382 | (:count . ,count) |
| 2374 | (:count . ,count) | 2383 | (:longest . ,max) |
| 2375 | (:longest . ,max) | 2384 | (:shortest . ,min) |
| 2376 | (:shortest . ,min) | 2385 | (:flags . 0) |
| 2377 | (:flags . 0) | 2386 | (:delim . ,delim) |
| 2378 | (:delim . ,delim) | 2387 | (:offset . ,(mapcar (lambda (o) |
| 2379 | (:offset . ,(mapcar (lambda (o) | 2388 | (list (cons :foo o))) |
| 2380 | (list (cons :foo o))) | 2389 | (nreverse offsets)))))) |
| 2381 | (nreverse offsets))))))) | ||
| 2382 | (let ((coding-system-for-write 'raw-text-unix)) | 2390 | (let ((coding-system-for-write 'raw-text-unix)) |
| 2383 | (write-file (or index (concat cookies ".dat"))))))) | 2391 | (write-file (or index (concat cookies ".dat"))))))) |
| 2384 | @end lisp | 2392 | @end lisp |
diff --git a/lispref/text.texi b/lispref/text.texi index c9f1a83a74c..426ec1ef00f 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -2967,7 +2967,8 @@ time you want to specify a particular attribute for certain text. | |||
| 2967 | @item | 2967 | @item |
| 2968 | A cons cell of the form @code{(foreground-color . @var{color-name})} or | 2968 | A cons cell of the form @code{(foreground-color . @var{color-name})} or |
| 2969 | @code{(background-color . @var{color-name})}. These elements specify | 2969 | @code{(background-color . @var{color-name})}. These elements specify |
| 2970 | just the foreground color or just the background color. | 2970 | just the foreground color or just the background color. @xref{Color |
| 2971 | Names}, for the supported forms of @var{color-name}. | ||
| 2971 | 2972 | ||
| 2972 | @code{(foreground-color . @var{color-name})} is equivalent to | 2973 | @code{(foreground-color . @var{color-name})} is equivalent to |
| 2973 | specifying @code{(:foreground @var{color-name})}, and likewise for the | 2974 | specifying @code{(:foreground @var{color-name})}, and likewise for the |
diff --git a/lispref/tips.texi b/lispref/tips.texi index 889ac3e6a6d..6ad1c166e5b 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi | |||
| @@ -35,6 +35,7 @@ all. | |||
| 35 | @node Coding Conventions | 35 | @node Coding Conventions |
| 36 | @section Emacs Lisp Coding Conventions | 36 | @section Emacs Lisp Coding Conventions |
| 37 | 37 | ||
| 38 | @cindex coding conventions in Emacs Lisp | ||
| 38 | Here are conventions that you should follow when writing Emacs Lisp | 39 | Here are conventions that you should follow when writing Emacs Lisp |
| 39 | code intended for widespread use: | 40 | code intended for widespread use: |
| 40 | 41 | ||
| @@ -52,9 +53,9 @@ don't postpone it. | |||
| 52 | @item | 53 | @item |
| 53 | Since all global variables share the same name space, and all | 54 | Since all global variables share the same name space, and all |
| 54 | functions share another name space, you should choose a short word to | 55 | functions share another name space, you should choose a short word to |
| 55 | distinguish your program from other Lisp programs.@footnote{The | 56 | distinguish your program from other Lisp programs@footnote{The |
| 56 | benefits of a Common Lisp-style package system are considered not to | 57 | benefits of a Common Lisp-style package system are considered not to |
| 57 | outweigh the costs.} Then take care to begin the names of all global | 58 | outweigh the costs.}. Then take care to begin the names of all global |
| 58 | variables, constants, and functions in your program with the chosen | 59 | variables, constants, and functions in your program with the chosen |
| 59 | prefix. This helps avoid name conflicts. | 60 | prefix. This helps avoid name conflicts. |
| 60 | 61 | ||
| @@ -173,9 +174,28 @@ compatibility issues. | |||
| 173 | @end example | 174 | @end example |
| 174 | 175 | ||
| 175 | @item | 176 | @item |
| 176 | Redefining (or advising) an Emacs primitive is discouraged. It may do | 177 | Redefining (or advising) an Emacs primitive is a bad idea. It may do |
| 177 | the right thing for a particular program, but there is no telling what | 178 | the right thing for a particular program, but there is no telling what |
| 178 | other programs might break as a result. | 179 | other programs might break as a result. In any case, it is a problem |
| 180 | for debugging, because the two advised function doesn't do what its | ||
| 181 | source code says it does. If the programmer investigating the problem | ||
| 182 | is unaware that there is advice on the function, the experience can be | ||
| 183 | very frustrating. | ||
| 184 | |||
| 185 | We hope to remove all the places in Emacs that advise primitives. | ||
| 186 | In the mean time, please don't add any more. | ||
| 187 | |||
| 188 | @item | ||
| 189 | It is likewise a bad idea for one Lisp package to advise a function | ||
| 190 | in another Lisp package. | ||
| 191 | |||
| 192 | @item | ||
| 193 | Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for | ||
| 194 | Loading}) in libraries and packages. This feature is meant for | ||
| 195 | personal customizations; using it in a Lisp program is unclean because | ||
| 196 | it modifies the behavior of another Lisp file in an invisible way. | ||
| 197 | This is an obstacle for debugging, much like advising a function in | ||
| 198 | the other package. | ||
| 179 | 199 | ||
| 180 | @item | 200 | @item |
| 181 | If a file does replace any of the functions or library programs of | 201 | If a file does replace any of the functions or library programs of |
| @@ -204,6 +224,32 @@ only for special-purpose buffers.) The users will find Emacs more | |||
| 204 | coherent if all libraries use the same conventions. | 224 | coherent if all libraries use the same conventions. |
| 205 | 225 | ||
| 206 | @item | 226 | @item |
| 227 | If your program contains non-ASCII characters in string or character | ||
| 228 | constants, you should make sure Emacs always decodes these characters | ||
| 229 | the same way, regardless of the user's settings. There are two ways | ||
| 230 | to do that: | ||
| 231 | |||
| 232 | @itemize - | ||
| 233 | @item | ||
| 234 | Use coding system @code{emacs-mule}, and specify that for | ||
| 235 | @code{coding} in the @samp{-*-} line or the local variables list. | ||
| 236 | |||
| 237 | @example | ||
| 238 | ;; XXX.el -*- coding: emacs-mule; -*- | ||
| 239 | @end example | ||
| 240 | |||
| 241 | @item | ||
| 242 | Use one of the coding systems based on ISO 2022 (such as | ||
| 243 | iso-8859-@var{n} and iso-2022-7bit), and specify it with @samp{!} at | ||
| 244 | the end for @code{coding}. (The @samp{!} turns off any possible | ||
| 245 | character translation.) | ||
| 246 | |||
| 247 | @example | ||
| 248 | ;; XXX.el -*- coding: iso-latin-2!; -*- | ||
| 249 | @end example | ||
| 250 | @end itemize | ||
| 251 | |||
| 252 | @item | ||
| 207 | Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the | 253 | Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the |
| 208 | default indentation parameters. | 254 | default indentation parameters. |
| 209 | 255 | ||
diff --git a/lispref/windows.texi b/lispref/windows.texi index a2746889633..af73339a311 100644 --- a/lispref/windows.texi +++ b/lispref/windows.texi | |||
| @@ -161,10 +161,8 @@ The two ``halves'' of the split window initially display the same buffer | |||
| 161 | previously visible in the window that was split. | 161 | previously visible in the window that was split. |
| 162 | 162 | ||
| 163 | @deffn Command split-window &optional window size horizontal | 163 | @deffn Command split-window &optional window size horizontal |
| 164 | This function splits @var{window} into two windows. The original | 164 | This function splits a new window out of @var{window}'s screen area. |
| 165 | window @var{window} remains the selected window, but occupies only | 165 | It returns the new window. |
| 166 | part of its former screen area. The rest is occupied by a newly created | ||
| 167 | window which is returned as the value of this function. | ||
| 168 | 166 | ||
| 169 | If @var{horizontal} is non-@code{nil}, then @var{window} splits into | 167 | If @var{horizontal} is non-@code{nil}, then @var{window} splits into |
| 170 | two side by side windows. The original window @var{window} keeps the | 168 | two side by side windows. The original window @var{window} keeps the |
| @@ -175,11 +173,13 @@ lines to the new window. The original window is therefore the | |||
| 175 | left-hand or upper of the two, and the new window is the right-hand or | 173 | left-hand or upper of the two, and the new window is the right-hand or |
| 176 | lower. | 174 | lower. |
| 177 | 175 | ||
| 178 | If @var{window} is omitted or @code{nil}, then the selected window is | 176 | If @var{window} is omitted or @code{nil}, that stands for the selected |
| 179 | split. If @var{size} is omitted or @code{nil}, then @var{window} is | 177 | window. When you split the selected window, it remains selected. |
| 180 | divided evenly into two parts. (If there is an odd line, it is | 178 | |
| 181 | allocated to the new window.) When @code{split-window} is called | 179 | If @var{size} is omitted or @code{nil}, then @var{window} is divided |
| 182 | interactively, all its arguments are @code{nil}. | 180 | evenly into two parts. (If there is an odd line, it is allocated to |
| 181 | the new window.) When @code{split-window} is called interactively, | ||
| 182 | all its arguments are @code{nil}. | ||
| 183 | 183 | ||
| 184 | If splitting would result in making a window that is smaller than | 184 | If splitting would result in making a window that is smaller than |
| 185 | @code{window-min-height} or @code{window-min-width}, the function | 185 | @code{window-min-height} or @code{window-min-width}, the function |