aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog138
-rw-r--r--lispref/commands.texi2
-rw-r--r--lispref/compile.texi5
-rw-r--r--lispref/display.texi406
-rw-r--r--lispref/elisp.texi4
-rw-r--r--lispref/files.texi18
-rw-r--r--lispref/help.texi2
-rw-r--r--lispref/internals.texi7
-rw-r--r--lispref/keymaps.texi117
-rw-r--r--lispref/minibuf.texi13
-rw-r--r--lispref/modes.texi10
-rw-r--r--lispref/nonascii.texi20
-rw-r--r--lispref/objects.texi13
-rw-r--r--lispref/processes.texi70
-rw-r--r--lispref/text.texi3
-rw-r--r--lispref/tips.texi54
-rw-r--r--lispref/windows.texi18
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 @@
12006-06-10 Luc Teirlinck <teirllm@auburn.edu>
2
3 * tips.texi (Coding Conventions): Add `@end itemize'.
4
52006-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
102006-06-09 Aidan Kehoe <kehoea@parhasard.net>
11
12 * objects.texi (Character Type): Describe the\uABCD and \U00ABCDEF
13 syntax.
14
152006-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
232006-06-04 Thien-Thi Nguyen <ttn@gnu.org>
24
25 * display.texi (Abstract Display): Fix typo.
26
272006-06-03 Eli Zaretskii <eliz@gnu.org>
28
29 * minibuf.texi (Minibuffer History) <history-add-new-input>:
30 Reword variable's description.
31
322006-06-01 Richard Stallman <rms@gnu.org>
33
34 * windows.texi (Splitting Windows): Clarify splitting nonselected
35 window.
36
372006-05-31 Juri Linkov <juri@jurta.org>
38
39 * minibuf.texi (Minibuffer History): Add history-add-new-input.
40
412006-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
482006-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
552006-05-30 Eli Zaretskii <eliz@gnu.org>
56
57 * nonascii.texi (Default Coding Systems): Fix it some more.
58
592006-05-29 Eli Zaretskii <eliz@gnu.org>
60
61 * nonascii.texi (Default Coding Systems): Fix last change.
62
632006-05-29 Kenichi Handa <handa@m17n.org>
64
65 * nonascii.texi (find-operation-coding-system): Describe the new
66 argument format (FILENAME . BUFFER).
67
682006-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
732006-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
782006-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
872006-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
952006-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
1002006-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
1052006-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
1112006-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
1182006-05-25 Chong Yidong <cyd@stupidchicken.com>
119
120 * keymaps.texi (Key Sequences): Some clarifications.
121
1222006-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
1282006-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
12006-05-23 Luc Teirlinck <teirllm@auburn.edu> 1372006-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
5102005-12-23 Eli Zaretskii <eliz@gnu.org> 6462005-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
5152005-12-20 Richard M. Stallman <rms@gnu.org> 6512005-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
362the argument's value. No I/O. 362the argument's value. No I/O.
363 363
364@item k 364@item k
365A key sequence (@pxref{Keymap Terminology}). This keeps reading events 365A key sequence (@pxref{Key Sequences}). This keeps reading events
366until a command (or undefined command) is found in the current key 366until a command (or undefined command) is found in the current key
367maps. The key sequence argument is represented as a string or vector. 367maps. The key sequence argument is represented as a string or vector.
368The cursor does not move into the echo area. Prompt. 368The 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
435you load the source file, rather than compiling it, @var{body} is 435you load the source file, rather than compiling it, @var{body} is
436evaluated normally. 436evaluated normally.
437 437
438@cindex compile-time constant
438If you have a constant that needs some calculation to produce, 439If 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,
440example,
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
447If you're using another package, but only need macros from it (the 448If you're using another package, but only need macros from it (the
448byte compiler will expand those), then @code{eval-when-compile} can be 449byte compiler will expand those), then @code{eval-when-compile} can be
449used to load it for compiling, but not executing. For example, 450used 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
1584contents of the line, and additional vertical line spacing below the 1585contents of the line, plus optional additional vertical line spacing
1585display row. 1586above 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
1588maximum height of any character or image on that display line, 1589character or image on that display line, including the final newline
1589including the final newline if there is one. (A line that is 1590if there is one. (A display line that is continued doesn't include a
1590continued doesn't include a final newline.) In the most common case, 1591final newline.) That is the default line height, if you do nothing to
1591the line height equals the height of the default frame font. 1592specify a greater height. (In the most common case, this equals the
1593height 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,
1594height, either by specifying an absolute height for the display line, 1596either by specifying an absolute height for the display line, or by
1595or by adding additional vertical space below one or all lines. 1597specifying vertical space. However, no matter what you specify, the
1598actual 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
1599that controls the total height of the display line ending in that 1602that controls the total height of the display line ending in that
1600newline. 1603newline.
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
1603then @var{height} is used as the actual property value for the 1606effect on the displayed height of the line---the visible contents
1604@code{line-height}, and @var{total} specifies the total displayed 1607alone determine the height. This is useful for tiling small images
1605height of the line, so the line spacing added below the line equals 1608(or image slices) without adding blank areas between the images.
1606the @var{total} height minus the actual line height. In this case,
1607the 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}
1610line is exactly what its contents demand; no line-spacing is added. 1611@var{total})}, that adds extra space @emph{below} the display line.
1611This case is useful for tiling small images or image slices without 1612First Emacs uses @var{height} as a height spec to control extra space
1612adding blank areas between the images. 1613@emph{above} the line; then it adds enough space @emph{below} the line
1614to bring the total line height up to @var{total}. In this case, the
1615other 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
1615spec stands for a numeric height value; this height spec specifies the 1618into a number---the specified line height. There are several ways to
1616actual line height, @var{line-height}. There are several ways to 1619write a height spec; here's how each of them translates into a number:
1617write a height spec; here's how each of them translates into a numeric
1618height:
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
1633is @var{ratio} times the height of the contents of the line. 1634is @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 1638or another. If the line contents' height is less than that, Emacs
1638is less than @var{line-height}, Emacs adds extra vertical space above 1639adds extra vertical space above the line to achieve the specified
1639the line to achieve the total height @var{line-height}. Otherwise, 1640total 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
1643height consists of the contents' height plus the line spacing. 1643height 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
1665property that controls the height of the display line ending with that 1665property that overrides the default frame line spacing and the buffer
1666newline. The property value overrides the default frame line spacing 1666local @code{line-spacing} variable, for the display line ending in
1667and the buffer local @code{line-spacing} variable. 1667that 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
1670spacing of each line. The value is a height spec, and it translates 1670spacing of each line. The value is a height spec, and it translates
@@ -2381,13 +2381,6 @@ expression in the list. For example,
2381allows the use of scalable fonts with registry @code{muleindian-2}. 2381allows 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
2386This function clears the face cache for all frames.
2387If @var{unload-p} is non-@code{nil}, that means to unload
2388all unused fonts as well.
2389@end defun
2390
2391@defvar face-font-rescale-alist 2384@defvar face-font-rescale-alist
2392This variable specifies scaling for certain faces. Its value should 2385This variable specifies scaling for certain faces. Its value should
2393be a list of elements of the form 2386be 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
4626of Lisp objects, and updates the text to follow changes in that
4627structure. 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
4631construct buffer text that represents certain Lisp data. The buffer
4632text of the ewoc has three parts, in order: first, fixed @dfn{header}
4633text; next, textual descriptions of a series of data elements (Lisp
4634objects that you specify); and last, fixed @dfn{footer} text.
4635Specifically, an ewoc contains information on:
4636
4637@itemize @bullet
4638@item
4639The buffer which its text is generated in.
4640
4641@item
4642The text's start position in the buffer.
4643
4644@item
4645The header and footer strings.
4646
4647@item
4648A doubly-linked chain of @dfn{nodes}, each of which contains:
4649
4650@itemize
4651@item
4652A @dfn{data element}, a single Lisp object.
4653
4654@item
4655Links to the preceding and following nodes in the chain.
4656@end itemize
4657
4658@item
4659A @dfn{pretty-printer} function which is responsible for
4660inserting the textual representation of a data
4661element value into the current buffer.
4662@end itemize
4663
4664 Typically, you define an ewoc with @code{ewoc-create}, and then pass
4665the resulting ewoc structure to other functions in the Ewoc package to
4666build nodes within it, and display it in the buffer. Once it is
4667displayed in the buffer, other functions determine the correspondance
4668between buffer positions and nodes, move point from one node's textual
4669representation to another, and so forth. @xref{Abstract Display
4670Functions}.
4671
4672 A node @dfn{encapsulates} a data element much the way a variable
4673holds a value. Normally, encapsulation occurs as a part of adding a
4674node to the ewoc. You can retrieve the data element value and place a
4675new 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
4686You can also use, as the data element value, a Lisp object (list or
4687vector) that is a container for the ``real'' value, or an index into
4688some other structure. The example (@pxref{Abstract Display Example})
4689uses the latter approach.
4690
4691 When the data changes, you will want to update the text in the
4692buffer. You can update all nodes by calling @code{ewoc-refresh}, or
4693just specific nodes using @code{ewoc-invalidate}, or all nodes
4694satisfying a predicate using @code{ewoc-map}. Alternatively, you can
4695delete invalid nodes using @code{ewoc-delete} or @code{ewoc-filter},
4696and add new nodes in their place. Deleting a node from an ewoc deletes
4697its 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
4708structures 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
4712This constructs and returns a new ewoc, with no nodes (and thus no data
4713elements). @var{pretty-printer} should be a function that takes one
4714argument, a data element of the sort you plan to use in this ewoc, and
4715inserts its textual description at point using @code{insert} (and never
4716@code{insert-before-markers}, because that would interfere with the
4717Ewoc package's internal mechanisms).
4718
4719Normally, a newline is automatically inserted after the header,
4720the footer and every node's textual description. If @var{nosep}
4721is non-@code{nil}, no newline is inserted. This may be useful for
4722displaying an entire ewoc on a single line, for example, or for
4723making nodes ``invisible'' by arranging for @var{pretty-printer}
4724to do nothing for those nodes.
4725
4726An ewoc maintains its text in the buffer that is current when
4727you create it, so switch to the intended buffer before calling
4728@code{ewoc-create}.
4729@end defun
4730
4731@defun ewoc-buffer ewoc
4732This returns the buffer where @var{ewoc} maintains its text.
4733@end defun
4734
4735@defun ewoc-get-hf ewoc
4736This returns a cons cell @code{(@var{header} . @var{footer})}
4737made from @var{ewoc}'s header and footer.
4738@end defun
4739
4740@defun ewoc-set-hf ewoc header footer
4741This 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
4747These add a new node encapsulating @var{data}, putting it, respectively,
4748at 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
4753These 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
4759These return, respectively, the previous node and the next node of @var{node}
4760in @var{ewoc}.
4761@end defun
4762
4763@defun ewoc-nth ewoc n
4764This returns the node in @var{ewoc} found at zero-based index @var{n}.
4765A 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
4770This extracts the data encapsulated by @var{node} and returns it.
4771@end defun
4772
4773@defun ewoc-set-data node data
4774This sets the data encapsulated by @var{node} to @var{data}.
4775@end defun
4776
4777@defun ewoc-locate ewoc &optional pos guess
4778This determines the node in @var{ewoc} which contains point (or
4779@var{pos} if specified), and returns that node. If @var{ewoc} has no
4780nodes, it returns @code{nil}. If @var{pos} is before the first node,
4781it returns the first node; if @var{pos} is after the last node, it returns
4782the last node. The optional third arg @var{guess}
4783should be a node that is likely to be near @var{pos}; this doesn't
4784alter the result, but makes the function run faster.
4785@end defun
4786
4787@defun ewoc-location node
4788This 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
4793These move point to the previous or next, respectively, @var{arg}th node
4794in @var{ewoc}. @code{ewoc-goto-prev} does not move if it is already at
4795the first node or if @var{ewoc} is empty, whereas @code{ewoc-goto-next}
4796moves past the last node, returning @code{nil}. Excepting this special
4797case, these functions return the node moved to.
4798@end defun
4799
4800@defun ewoc-goto-node ewoc node
4801This moves point to the start of @var{node} in @var{ewoc}.
4802@end defun
4803
4804@defun ewoc-refresh ewoc
4805This function regenerates the text of @var{ewoc}. It works by
4806deleting the text between the header and the footer, i.e., all the
4807data elements' representations, and then calling the pretty-printer
4808function for each node, one by one, in order.
4809@end defun
4810
4811@defun ewoc-invalidate ewoc &rest nodes
4812This 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
4817This deletes each node in @var{nodes} from @var{ewoc}.
4818@end defun
4819
4820@defun ewoc-filter ewoc predicate &rest args
4821This calls @var{predicate} for each data element in @var{ewoc} and
4822deletes those nodes for which @var{predicate} returns @code{nil}.
4823Any @var{args} are passed to @var{predicate}.
4824@end defun
4825
4826@defun ewoc-collect ewoc predicate &rest args
4827This calls @var{predicate} for each data element in @var{ewoc}
4828and returns a list of those elements for which @var{predicate}
4829returns non-@code{nil}. The elements in the list are ordered
4830as in the buffer. Any @var{args} are passed to @var{predicate}.
4831@end defun
4832
4833@defun ewoc-map map-function ewoc &rest args
4834This calls @var{map-function} for each data element in @var{ewoc} and
4835updates those nodes for which @var{map-function} returns non-@code{nil}.
4836Any @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
4843implement a ``color components display'', an area in a buffer that
4844represents a vector of three integers (itself representing a 24-bit RGB
4845value) 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.
4871The 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
4901other words, the controller part of the ``model/view/controller''
4902design paradigm) by defining commands to modify @code{colorcomp-data}
4903and to ``finish'' the selection process, and a keymap to tie it all
4904together 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.
4925The 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
4946Note that we never modify the data in each node, which is fixed when the
4947ewoc 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
591Keymaps 591Keymaps
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
1431same effect as renaming, aside from momentary intermediate states. 1431same 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
1435This command copies the file @var{oldname} to @var{newname}. An 1435This command copies the file @var{oldname} to @var{newname}. An
1436error is signaled if @var{oldname} does not exist. If @var{newname} 1436error is signaled if @var{oldname} does not exist. If @var{newname}
1437names a directory, it copies @var{oldname} into that directory, 1437names a directory, it copies @var{oldname} into that directory,
@@ -1440,16 +1440,18 @@ preserving its final name component.
1440If @var{time} is non-@code{nil}, then this function gives the new file 1440If @var{time} is non-@code{nil}, then this function gives the new file
1441the same last-modified time that the old one has. (This works on only 1441the same last-modified time that the old one has. (This works on only
1442some operating systems.) If setting the time gets an error, 1442some 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
1444interactive call, a prefix argument specifies a non-@code{nil} value
1445for @var{time}.
1444 1446
1445This function copies the file modes, too. 1447This function copies the file modes, too.
1446 1448
1447In an interactive call, a prefix argument specifies a non-@code{nil} 1449If argument @var{preserve-uid-gid} is @code{nil}, we let the operating
1448value for @var{time}. 1450system decide the user and group ownership of the new file (this is
1449 1451usually set to the user running Emacs). If @var{preserve-uid-gid} is
1450The argument @var{mustbenew} controls whether an existing file can be 1452non-@code{nil}, we attempt to copy the user and group ownership of the
1451overwritten. It works like the similarly-named argument of 1453file. This works only on some operating systems, and only if you have
1452@code{write-region} (@pxref{Writing to Files, mustbenew}). 1454the 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
497call it with a string containing key descriptions, separated by spaces; 497call it with a string containing key descriptions, separated by spaces;
498it returns a string or vector containing the corresponding events. 498it 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
500events you use; @pxref{Keymap Terminology}.) If @var{need-vector} is 500events you use; @pxref{Key Sequences}.) If @var{need-vector} is
501non-@code{nil}, the return value is always a vector. 501non-@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
160the part that didn't fit. If that happens, you should increase the 160the part that didn't fit. If that happens, you should increase the
161compilation parameter @code{PURESIZE} in the file 161compilation 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
163image will work. Such an overflow normally won't happen unless you 163image will work: garbage collection is disabled in this situation,
164causing a memory leak. Such an overflow normally won't happen unless you
164try to preload additional libraries or add features to the standard 165try to preload additional libraries or add features to the standard
165ones. Emacs will display a warning about the overflow when it 166ones. Emacs will display a warning about the overflow when it
166starts. 167starts.
@@ -348,6 +349,10 @@ operating system, but which are currently not in use. (A string
348object consists of a header and the storage for the string text 349object consists of a header and the storage for the string text
349itself; the latter is only allocated when the string is created.) 350itself; the latter is only allocated when the string is created.)
350@end table 351@end table
352
353If there was overflow in pure space (see the previous section),
354@code{garbage-collect} returns @code{nil}, because a real garbage
355collection 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
16found. The whole process is called @dfn{key lookup}. 16found. 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
48or more input events that form a unit. Input events include
49characters, function keys, and mouse actions (@pxref{Input Events}).
50The Emacs Lisp representation for a key sequence is a string or
51vector. Unless otherwise stated, any Emacs Lisp function that accepts
52a key sequence as an argument can handle both representations.
53
54 In the string representation, alphanumeric characters ordinarily
55stand for themselves; for example, @code{"a"} represents @kbd{a} and
56and @code{"2"} represents @kbd{2}. Control character events are
57prefixed by the substring @code{"\C-"}, and meta characters by
58@code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}.
59In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events
60are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and
61@code{"\d"} respectively. The string representation of a complete key
62sequence is the concatenation of the string representations of the
63constituent 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
67non-ASCII characters such as @kbd{C-=} or @kbd{H-a} cannot be
68represented as strings; they have to be represented as vectors.
69
70 In the vector representation, each element of the vector represents
71an input event, in its Lisp form. @xref{Input Events}. For example,
72the 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
75representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}.
76
77@defmac kbd keyseq-text
78This macro converts the text @var{keyseq-text} (a string constant)
79into a key sequence (a string or vector constant). The contents of
80@var{keyseq-text} should describe the key sequence using almost the same
81syntax used in this manual. More precisely, it uses the same syntax
82that Edit Macro mode uses for editing keyboard macros (@pxref{Edit
83Keyboard Macro,,, emacs, The GNU Emacs Manual}); you must surround
84function 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}
50can be any Lisp objects, though only certain types are meaningful for 106for various key sequences.
51execution by the command loop). Given an event (or an event type) and a
52keymap, Emacs can get the event's definition. Events include
53characters, 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
57is 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
60the key sequence is a single event, its binding is the definition of the 109events. When a key sequence consists of a single event, its binding
61event in the keymap. The binding of a key sequence of more than one 110in a keymap is the keymap's definition for that event. The binding of
62event is found by an iterative process: the binding of the first event 111a longer key sequence is found by an iterative process: first find the
63is found, and must be a keymap; then the second event's binding is found 112definition of the first event (which must itself be a keymap); then
64in that keymap, and so on until all the events in the key sequence are 113find the second event's definition in that keymap, and so on until all
65used up. 114the 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
68a @dfn{prefix key}. Otherwise, we call it a @dfn{complete key} (because 117a @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
98keymaps shadow both local and global keymaps. @xref{Active Keymaps}, 147keymaps shadow both local and global keymaps. @xref{Active Keymaps},
99for details. 148for details.
100 149
101 The Emacs Lisp representation for a key sequence is a string or vector.
102You can enter key sequence constants using the ordinary string or vector
103representation; it is also convenient to use @code{kbd}:
104
105@defmac kbd keyseq-text
106This macro converts the text @var{keyseq-text} (a string constant)
107into a key sequence (a string or vector constant). The contents
108of @var{keyseq-text} should describe the key sequence using the syntax
109used in this manual. More precisely, it uses the same syntax that
110Edit Macro mode uses for editing keyboard macros (@pxref{Edit Keyboard
111Macro,,, 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
133remaining elements of the list define the key bindings of the keymap. 158remaining elements of the list define the key bindings of the keymap.
134A symbol whose function definition is a keymap is also a keymap. Use 159A symbol whose function definition is a keymap is also a keymap. Use
135the function @code{keymapp} (see below) to test whether an object is a 160the 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
1198a keymap or if @var{key} is not a string or vector representing a key 1223a keymap or if @var{key} is not a string or vector representing a key
1199sequence. You can use event types (symbols) as shorthand for events 1224sequence. You can use event types (symbols) as shorthand for events
1200that are lists. The @code{kbd} macro (@pxref{Keymap Terminology}) is 1225that are lists. The @code{kbd} macro (@pxref{Key Sequences}) is a
1201a convenient way to specify the key sequence. 1226convenient way to specify the key sequence.
1202 1227
1203@defun define-key keymap key binding 1228@defun define-key keymap key binding
1204This function sets the binding for @var{key} in @var{keymap}. (If 1229This 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
110reading the arguments for a command, in the @code{interactive} 110reading the arguments for a command, in the @code{interactive}
111specification. @xref{Defining Commands}. 111specification. @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
114This function is the most general way to get input through the 114This function is the most general way to get input through the
115minibuffer. By default, it accepts arbitrary text and returns it as a 115minibuffer. By default, it accepts arbitrary text and returns it as a
116string; however, if @var{read} is non-@code{nil}, then it uses 116string; however, if @var{read} is non-@code{nil}, then it uses
@@ -162,9 +162,6 @@ the setting of @code{enable-multibyte-characters} (@pxref{Text
162Representations}) from whichever buffer was current before entering the 162Representations}) from whichever buffer was current before entering the
163minibuffer. 163minibuffer.
164 164
165If @var{keep-all} is non-@code{nil}, even empty and duplicate inputs
166are added to the history list.
167
168Use of @var{initial-contents} is mostly deprecated; we recommend using 165Use of @var{initial-contents} is mostly deprecated; we recommend using
169a non-@code{nil} value only in conjunction with specifying a cons cell 166a non-@code{nil} value only in conjunction with specifying a cons cell
170for @var{hist}. @xref{Initial Input}. 167for @var{hist}. @xref{Initial Input}.
@@ -463,6 +460,14 @@ However, if @var{keep-all} is non-@code{nil}, that says not to remove
463duplicates, and to add @var{newelt} to the list even if it is empty. 460duplicates, 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
464If the value of this variable is @code{nil}, standard functions that
465read from the minibuffer don't add new elements to the history list.
466This lets Lisp programs explicitly manage input history by using
467@code{add-to-history}. By default, @code{history-add-new-input} is
468set to a non-@code{nil} value.
469@end defvar
470
466@defvar history-length 471@defvar history-length
467The value of this variable specifies the maximum length for all 472The value of this variable specifies the maximum length for all
468history lists that don't specify their own maximum lengths. If the 473history 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
1928The current column number of point. 1928The current column number of point.
1929 1929
1930@item %e
1931When Emacs is nearly out of memory for Lisp objects, a brief message
1932saying so. Otherwise, this is empty.
1933
1930@item %f 1934@item %f
1931The visited file name, obtained with the @code{buffer-file-name} 1935The visited file name, obtained with the @code{buffer-file-name}
1932function. @xref{Buffer File Name}. 1936function. @xref{Buffer File Name}.
@@ -1972,6 +1976,12 @@ Whether the visited file is a text file or a binary file. This is a
1972meaningful distinction only on certain operating systems (@pxref{MS-DOS 1976meaningful distinction only on certain operating systems (@pxref{MS-DOS
1973File Types}). 1977File Types}).
1974 1978
1979@item %z
1980The mnemonics of buffer, terminal, and keyboard coding systems.
1981
1982@item %Z
1983Like @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},
1105or @code{open-network-stream}. These are the names of the Emacs I/O 1105or @code{open-network-stream}. These are the names of the Emacs I/O
1106primitives that can do coding system conversion. 1106primitives that can do character code and eol conversion.
1107 1107
1108The remaining arguments should be the same arguments that might be given 1108The remaining arguments should be the same arguments that might be given
1109to that I/O primitive. Depending on the primitive, one of those 1109to the corresponding I/O primitive. Depending on the primitive, one
1110arguments is selected as the @dfn{target}. For example, if 1110of 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
1112name is the target. For subprocess primitives, the process name is the 1112name is the target. For subprocess primitives, the process name is the
1113target. For @code{open-network-stream}, the target is the service name 1113target. For @code{open-network-stream}, the target is the service name
@@ -1115,7 +1115,19 @@ or port number.
1115 1115
1116Depending on @var{operation}, this function looks up the target in 1116Depending 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},
1118or @code{network-coding-system-alist}. 1118or @code{network-coding-system-alist}. If the target is found in the
1119alist, @code{find-operation-coding-system} returns its association in
1120the alist; otherwise it returns @code{nil}.
1121
1122If @var{operation} is @code{insert-file-contents}, the argument
1123corresponding to the target may be a cons cell of the form
1124@code{(@var{filename} . @var{buffer})}). In that case, @var{filename}
1125is 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
1127decoded). If @code{file-coding-system-alist} specifies a function to
1128call for this file, and that function needs to examine the file's
1129contents (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
431bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper. 431bit 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
436code points. @code{?\u@var{nnnn}} represents a character that maps to
437the Unicode code point @samp{U+@var{nnnn}}. There is a slightly
438different syntax for specifying characters with code points above
439@code{#xFFFF}; @code{\U00@var{nnnnnn}} represents the character whose
440Unicode code point is @samp{U+@var{nnnnnn}}, if such a character
441is supported by Emacs.
442
443 Unlike in some other programming languages, in Emacs Lisp this
444syntax is available for character literals, and (see later) in
445strings, 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
2189The data as a byte array. 2189The data as a byte array.
2190 2190
2191@item pos 2191@item bindat-idx
2192Current position of the unpacking or packing operation. 2192Current index into bindat-raw of the unpacking or packing operation.
2193 2193
2194@item struct 2194@item struct
2195Alist. 2195Alist.
@@ -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{}
2234Process the set of @var{field-spec}s recursively, in order, and loop
2235starting 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
2235previous field. For correct operation, each @var{field-spec} must 2238previous field. For correct operation, each @var{field-spec} must
2236include a name. 2239include 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
2244specification, @code{raw-data} to a byte array, and @var{struct} to an 2246specification, @code{bindat-raw} to a byte array, and @var{struct} to an
2245alist representing unpacked field data. 2247alist 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
2248This function unpacks data from the byte array @code{raw-data} 2250This function unpacks data from the unibyte string or byte
2251array @code{bindat-raw}
2249according to @var{spec}. Normally this starts unpacking at the 2252according to @var{spec}. Normally this starts unpacking at the
2250beginning of the byte array, but if @var{pos} is non-@code{nil}, it 2253beginning of the byte array, but if @var{bindat-idx} is non-@code{nil}, it
2251specifies a zero-based starting position to use instead. 2254specifies a zero-based starting position to use instead.
2252 2255
2253The value is an alist or nested alist in which each element describes 2256The 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
2274data (in memory), they preserve the data's @dfn{total length}, which is
2275the sum of all the fields' lengths, in bytes. This value is not
2276generally inherent in either the specification or alist alone; instead,
2277both pieces of information contribute to its calculation. Likewise, the
2278length of a string or array being unpacked may be longer than the data's
2279total 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 2282This function returns the total length of the data in @var{struct},
2272This function returns the length in bytes of @var{struct}, according 2283according to @var{spec}.
2273to @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
2277This function returns a byte array packed according to @var{spec} from 2287This function returns a byte array packed according to @var{spec} from
2278the data in the alist @var{struct}. Normally it creates and fills a 2288the data in the alist @var{struct}. Normally it creates and fills a
2279new byte array starting at the beginning. However, if @var{raw-data} 2289new byte array starting at the beginning. However, if @var{bindat-raw}
2280is non-@code{nil}, it specifies a pre-allocated string or vector to 2290is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to
2281pack into. If @var{pos} is non-@code{nil}, it specifies the starting 2291pack into. If @var{bindat-idx} is non-@code{nil}, it specifies the starting
2282offset for packing into @code{raw-data}. 2292offset for packing into @code{bindat-raw}.
2283 2293
2284@c ??? Isn't this a bug? Shouldn't it always be unibyte? 2294When pre-allocating, you should make sure @code{(length @var{bindat-raw})}
2285Note: The result is a multibyte string; use @code{string-make-unibyte} 2295meets or exceeds the total length to avoid an out-of-range error.
2286on 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
2968A cons cell of the form @code{(foreground-color . @var{color-name})} or 2968A 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
2970just the foreground color or just the background color. 2970just the foreground color or just the background color. @xref{Color
2971Names}, 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
2973specifying @code{(:foreground @var{color-name})}, and likewise for the 2974specifying @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
39code intended for widespread use: 40code intended for widespread use:
40 41
@@ -52,9 +53,9 @@ don't postpone it.
52@item 53@item
53Since all global variables share the same name space, and all 54Since all global variables share the same name space, and all
54functions share another name space, you should choose a short word to 55functions share another name space, you should choose a short word to
55distinguish your program from other Lisp programs.@footnote{The 56distinguish your program from other Lisp programs@footnote{The
56benefits of a Common Lisp-style package system are considered not to 57benefits of a Common Lisp-style package system are considered not to
57outweigh the costs.} Then take care to begin the names of all global 58outweigh the costs.}. Then take care to begin the names of all global
58variables, constants, and functions in your program with the chosen 59variables, constants, and functions in your program with the chosen
59prefix. This helps avoid name conflicts. 60prefix. 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
176Redefining (or advising) an Emacs primitive is discouraged. It may do 177Redefining (or advising) an Emacs primitive is a bad idea. It may do
177the right thing for a particular program, but there is no telling what 178the right thing for a particular program, but there is no telling what
178other programs might break as a result. 179other programs might break as a result. In any case, it is a problem
180for debugging, because the two advised function doesn't do what its
181source code says it does. If the programmer investigating the problem
182is unaware that there is advice on the function, the experience can be
183very frustrating.
184
185We hope to remove all the places in Emacs that advise primitives.
186In the mean time, please don't add any more.
187
188@item
189It is likewise a bad idea for one Lisp package to advise a function
190in another Lisp package.
191
192@item
193Likewise, avoid using @code{eval-after-load} (@pxref{Hooks for
194Loading}) in libraries and packages. This feature is meant for
195personal customizations; using it in a Lisp program is unclean because
196it modifies the behavior of another Lisp file in an invisible way.
197This is an obstacle for debugging, much like advising a function in
198the other package.
179 199
180@item 200@item
181If a file does replace any of the functions or library programs of 201If 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
204coherent if all libraries use the same conventions. 224coherent if all libraries use the same conventions.
205 225
206@item 226@item
227If your program contains non-ASCII characters in string or character
228constants, you should make sure Emacs always decodes these characters
229the same way, regardless of the user's settings. There are two ways
230to do that:
231
232@itemize -
233@item
234Use 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
242Use one of the coding systems based on ISO 2022 (such as
243iso-8859-@var{n} and iso-2022-7bit), and specify it with @samp{!} at
244the end for @code{coding}. (The @samp{!} turns off any possible
245character translation.)
246
247@example
248;; XXX.el -*- coding: iso-latin-2!; -*-
249@end example
250@end itemize
251
252@item
207Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the 253Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the
208default indentation parameters. 254default 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
161previously visible in the window that was split. 161previously 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
164This function splits @var{window} into two windows. The original 164This function splits a new window out of @var{window}'s screen area.
165window @var{window} remains the selected window, but occupies only 165It returns the new window.
166part of its former screen area. The rest is occupied by a newly created
167window which is returned as the value of this function.
168 166
169If @var{horizontal} is non-@code{nil}, then @var{window} splits into 167If @var{horizontal} is non-@code{nil}, then @var{window} splits into
170two side by side windows. The original window @var{window} keeps the 168two 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
175left-hand or upper of the two, and the new window is the right-hand or 173left-hand or upper of the two, and the new window is the right-hand or
176lower. 174lower.
177 175
178If @var{window} is omitted or @code{nil}, then the selected window is 176If @var{window} is omitted or @code{nil}, that stands for the selected
179split. If @var{size} is omitted or @code{nil}, then @var{window} is 177window. When you split the selected window, it remains selected.
180divided evenly into two parts. (If there is an odd line, it is 178
181allocated to the new window.) When @code{split-window} is called 179If @var{size} is omitted or @code{nil}, then @var{window} is divided
182interactively, all its arguments are @code{nil}. 180evenly into two parts. (If there is an odd line, it is allocated to
181the new window.) When @code{split-window} is called interactively,
182all its arguments are @code{nil}.
183 183
184If splitting would result in making a window that is smaller than 184If 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