aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-02-28 01:49:58 +0000
committerRichard M. Stallman1998-02-28 01:49:58 +0000
commitcc6d0d2c9435d5d065121468b3655f4941403685 (patch)
tree7c57ca2dba3335ed1d338cb2867499cd0c0381fa
parent19061fd4148ba24612c06fcff26378ef62a7b859 (diff)
downloademacs-cc6d0d2c9435d5d065121468b3655f4941403685.tar.gz
emacs-cc6d0d2c9435d5d065121468b3655f4941403685.zip
Initial revision
-rw-r--r--lispref/customize.texi765
-rw-r--r--lispref/nonascii.texi691
2 files changed, 1456 insertions, 0 deletions
diff --git a/lispref/customize.texi b/lispref/customize.texi
new file mode 100644
index 00000000000..738734fe7c4
--- /dev/null
+++ b/lispref/customize.texi
@@ -0,0 +1,765 @@
1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1997, 1998 Free Software Foundation, Inc.
4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/customize
6@node Customization, Loading, Macros, Top
7@chapter Writing Customization Definitions
8
9This chapter describes how to declare customization groups, variables,
10and faces. We use the term @dfn{customization item} to include all
11three of those. This has few examples, but please look at the file
12@file{cus-edit.el}, which contains many declarations you can learn from.
13
14@menu
15* Common Keywords::
16* Group Definitions::
17* Variable Definitions::
18* Face Definitions::
19* Customization Types::
20@end menu
21
22@node Common Keywords
23@section Common Keywords for All Kinds of Items
24
25All three kinds of customization declarations (for groups, variables,
26and faces) accept keyword arguments for specifying various information.
27This section describes some keywords that apply to all three.
28
29All of these keywords, except @code{:tag}, can be used more than once in
30a given item. Each use of the keyword has an independent effect. The
31keyword @code{:tag} is an exception because any given item can only
32display one name item.
33
34@table @code
35@item :group @var{group}
36Put this customization item in group @var{group}. When you use
37@code{:group} in a @code{defgroup}, it makes the new group a subgroup of
38@var{group}.
39
40If you use this keyword more than once, you can put a single item into
41more than one group. Displaying any of those groups will show this
42item. Be careful not to overdo this!
43
44@item :link @var{link-data}
45Include an external link after the documentation string for this item.
46This is a sentence containing an active field which references some
47other documentation.
48
49There are three alternatives you can use for @var{link-data}:
50
51@table @code
52@item (custom-manual @var{info-node})
53Link to an Info node; @var{info-node} is a string which specifies the
54node name, as in @code{"(emacs)Top"}. The link appears as
55@samp{[manual]} in the customization buffer.
56
57@item (info-link @var{info-node})
58Like @code{custom-manual} except that the link appears
59in the customization buffer with the Info node name.
60
61@item (url-link @var{url})
62Link to a web page; @var{url} is a string which specifies the URL. The
63link appears in the customization buffer as @var{url}.
64@end table
65
66You can specify the text to use in the customization buffer by adding
67@code{:tag @var{name}} after the first element of the @var{link-data};
68for example, @code{(info-link :tag "foo" "(emacs)Top")} makes a link to
69the Emacs manual which appears in the buffer as @samp{foo}.
70
71An item can have more than one external link; however, most items have
72none at all.
73
74@item :load @var{file}
75Load file @var{file} (a string) before displaying this customization
76item. Loading is done with @code{load-library}, and only if the file is
77not already loaded.
78
79@item :require @var{feature}
80Require feature @var{feature} (a symbol) when installing a value for
81this item (an option or a face) that was saved using the customization
82feature. This is done by calling @code{require}.
83
84The most common reason to use @code{:require} is when a variable enables
85a feature such as a minor mode, and just setting the variable won't have
86any effect unless the code which implements the mode is loaded.
87
88@item :tag @var{name}
89Use @var{name}, a string, instead of the item's name, to label the item
90in customization menus and buffers.
91@end table
92
93@node Group Definitions
94@section Defining Custom Groups
95
96Each Emacs Lisp package should have one main customization group which
97contains all the options, faces and other groups in the package. If the
98package has a small number of options and faces, use just one group and
99put everything in it. When there are more than twelve or so options and
100faces, then you should structure them into subgroups, and put the
101subgroups under the package's main customization group. It is ok to
102have some of the options and faces in the package's main group alongside
103the subgroups.
104
105The package's main or only group should be a member of one or more of
106the standard customization groups. Type press @kbd{C-h p} to display a
107list of finder keywords; them choose some of them add your group to each
108of them, using the @code{:group} keyword.
109
110The way to declare new customization groups is with @code{defgroup}.
111
112@tindex defgroup
113@defmac defgroup group members doc [keyword value]...
114Declare @var{group} as a customization group containing @var{members}.
115Do not quote the symbol @var{group}. The argument @var{doc} specifies
116the documentation string for the group.
117
118The arguments @var{members} can be an alist whose elements specify
119members of the group; however, normally @var{members} is @code{nil}, and
120you specify the group's members by using the @code{:group} keyword when
121defining those members.
122
123@ignore
124@code{(@var{name} @var{widget})}. Here @var{name} is a symbol, and
125@var{widget} is a widget for editing that symbol. Useful widgets are
126@code{custom-variable} for editing variables, @code{custom-face} for
127editing faces, and @code{custom-group} for editing groups.
128@end ignore
129
130In addition to the common keywords (@pxref{Common Keywords}), you can
131use this keyword in @code{defgroup}:
132
133@table @code
134@item :prefix @var{prefix}
135If the name of an item in the group starts with @var{prefix}, then the
136tag for that item is constructed (by default) by omitting @var{prefix}.
137
138One group can have any number of prefixes.
139@end table
140@end defmac
141
142The @code{:prefix} feature is currently turned off, which means that
143@code{:prefix} currently has no effect. We did this because we found
144that discarding the specified prefixes often led to confusing names for
145options. This happened because the people who wrote the @code{defgroup}
146definitions for various groups added @code{:prefix} keywords whenever
147they make logical sense---that is, whenever they say that there was a
148common prefix for the option names in a library.
149
150In order to obtain good results with @code{:prefix}, it is necessary to
151check the specific effects of discarding a particular prefix, given the
152specific items in a group and their names and documentation. If the
153resulting text is not clear, then @code{:prefix} should not be used in
154that case.
155
156It should be possible to recheck all the customization groups, delete
157the @code{:prefix} specifications which give unclear results, and then
158turn this feature back on, if someone would like to do the work.
159
160@node Variable Definitions
161@section Defining Customization Variables
162
163 Use @code{defcustom} to declare user editable variables.
164
165@tindex defcustom
166@defmac defcustom option value doc [keyword value]...
167Declare @var{option} as a customizable user option variable that
168defaults to @var{value}. Do not quote @var{option}. @var{value} should
169be an expression to compute the value; it will be be evaluated on more
170than one occasion.
171
172If @var{option} is void, @code{defcustom} initializes it to @var{value}.
173
174The argument @var{doc} specifies the documentation string for the variable.
175
176The following additional keywords are defined:
177
178@table @code
179@item :type @var{type}
180Use @var{type} as the data type for this option. It specifies which
181values are legitimate, and how to display the value.
182@xref{Customization Types}, for more information.
183
184@item :options @var{list}
185Specify @var{list} as the list of reasonable values for use in this
186option.
187
188Currently this is meaningful only when type is @code{hook}. The
189elements of @var{list} are functions that you might likely want to use
190as elements of the hook value. The user is not actually restricted to
191using only these functions, but they are offered as convenient
192alternatives.
193
194@item :version @var{version}
195This option specifies that the variable's default value was changed in
196Emacs version @var{version}. For example,
197
198@example
199(defcustom foo-max 34
200 "*Maximum number of foo's allowed."
201 :type 'integer
202 :group 'foo
203 :version "20.3")
204@end example
205
206@item :set @var{setfunction}
207Specify @var{setfunction} as the way to change the value of this option.
208The function @var{setfunction} should take two arguments, a symbol and
209the new value, and should do whatever is necessary to update the value
210properly for this option (which may not mean simply setting the option
211as a Lisp variable). The default for @var{setfunction} is
212@code{set-default}.
213
214@item :get @var{getfunction}
215Specify @var{getfunction} as the way to extract the value of this
216option. The function @var{getfunction} should take one argument, a
217symbol, and should return the ``current value'' for that symbol (which
218need not be the symbol's Lisp value). The default is
219@code{default-value}.
220
221@item :initialize @var{function}
222@var{function} should be a function used to initialize the variable when
223the @code{defcustom} is evaluated. It should take two arguments, the
224symbol and value. Here are some predefined functions meant for use in
225this way:
226
227@table @code
228@item custom-initialize-set
229Use the variable's @code{:set} function to initialize the variable. Do
230not reinitialize it if it is already non-void. This is the default
231@code{:initialize} function.
232
233@item custom-initialize-default
234Always use @code{set-default} to initialize the variable, even if some
235other @code{:set} function has been specified.
236
237@item custom-initialize-reset
238Even if the variable is already non-void, reset it by calling the
239@code{:set} function using the current value (returned by the
240@code{:get} method).
241
242@item custom-initialize-changed
243Like @code{custom-initialize-reset}, except use @code{set-default}
244(rather than the @code{:set} function) to initialize the variable if it
245is not bound and has not been set already.
246@end table
247
248@item :require @var{feature}
249If the user saves a customized value for this item, them Emacs should do
250@code{(require @var{feature})} after installing the saved value.
251
252The place to use this feature is for an option that turns on the
253operation of a certain feature. Assuming that the package is coded to
254check the value of the option, you still need to arrange for the package
255to be loaded. That is what @code{:require} is for.
256@end table
257@end defmac
258
259@ignore
260Use @code{custom-add-option} to specify that a specific function is
261useful as an member of a hook.
262
263@defun custom-add-option symbol option
264To the variable @var{symbol} add @var{option}.
265
266If @var{symbol} is a hook variable, @var{option} should be a hook
267member. For other types variables, the effect is undefined."
268@end defun
269@end ignore
270
271Internally, @code{defcustom} uses the symbol property
272@code{standard-value} to record the expression for the default value,
273and @code{saved-value} to record the value saved by the user with the
274customization buffer. The @code{saved-value} property is actually a
275list whose car is an expression which evaluates to the value.
276
277@node Face Definitions
278@section Defining Faces
279
280Faces are declared with @code{defface}.
281
282@tindex defface
283@defmac defface face spec doc [keyword value]...
284Declare @var{face} as a customizable face that defaults according to
285@var{spec}. Do not quote the symbol @var{face}.
286
287@var{doc} is the face documentation.
288
289@var{spec} should be an alist whose elements have the form
290@code{(@var{display} @var{atts})} (see below). When @code{defface}
291executes, it defines the face according to @var{spec}, then uses any
292customizations saved in the @file{.emacs} file to override that
293specification.
294
295In each element of @var{spec}, @var{atts} is a list of face attributes
296and their values. The possible attributes are defined in the variable
297@code{custom-face-attributes}.
298
299The @var{display} part of an element of @var{spec} determines which
300frames the element applies to. If more than one element of @var{spec}
301matches a given frame, the first matching element is the only one used
302for that frame.
303
304If @var{display} is @code{t} in a @var{spec} element, that element
305matches all frames. (This means that any subsequent elements of
306@var{spec} are never used.)
307
308Alternatively, @var{display} can be an alist whose elements have the
309form @code{(@var{characteristic} @var{value}@dots{})}. Here
310@var{characteristic} specifies a way of classifying frames, and the
311@var{value}s are possible classifications which @var{display} should
312apply to. Here are the possible values of @var{characteristic}:
313
314@table @code
315@item type
316The kind of window system the frame uses---either @code{x}, @code{pc}
317(for the MS-DOS console), @code{w32} (for MS Windows 9X/NT), or
318@code{tty}.
319
320@item class
321What kinds of colors the frame supports---either @code{color},
322@code{grayscale}, or @code{mono}.
323
324@item background
325The kind of background--- either @code{light} or @code{dark}.
326@end table
327
328If an element of @var{display} specifies more than one
329@var{value} for a given @var{characteristic}, any of those values
330is acceptable. If an element of @var{display} has elements for
331more than one @var{characteristic}, then @var{each} characteristic
332of the frame must match one of the values specified for it.
333@end defmac
334
335Internally, @code{defface} uses the symbol property
336@code{face-defface-spec} to record the face attributes specified in
337@code{defface}, @code{saved-face} for the attributes saved by the user
338with the customization buffer, and @code{face-documentation} for the
339documentation string.
340
341@node Customization Types
342@section Customization Types
343
344 When you define a user option with @code{defcustom}, you must specify
345its @dfn{customization type}. That is a Lisp object which indictaes (1)
346which values are legitimate and (2) how to display the value in the
347customization buffer for editing.
348
349 You specify the customization type in @code{defcustom} with the
350@code{:type} keyword. The argument of @code{:type} is evaluated; since
351types that vary at run time are rarely useful, normally it is a quoted
352constant. For example:
353
354@example
355(defcustom diff-command "diff"
356 "*The command to use to run diff."
357 :type 'string
358 :group 'diff)
359@end example
360
361 In general, a customization type appears is a list whose first element
362is a symbol, one of the customization type names defined in the
363following sections. After this symbol come a number of arguments,
364depending on the symbol. Some of the type symbols do not use any
365arguments; those are called @dfn{simple types}.
366
367 In between the type symbol and its arguments, you can optionally
368write keyword-value pairs. @xref{Type Keywords}.
369
370 For a simple type, if you do not use any keyword-value pairs, you can
371omit the parentheses around the type symbol. The above example does
372this, using just @code{string} as the customization type.
373But @code{(string)} would mean the same thing.
374
375@menu
376* Simple Types::
377* Composite Types::
378* Splicing into Lists::
379* Type Keywords::
380@end menu
381
382@node Simple Types
383@subsection Simple Types
384
385 This section describes all the simple customization types.
386
387@table @code
388@item sexp
389The value may be any Lisp object that can be printed and read back. You
390can use @code{sexp} as a fall-back for any option, if you don't want to
391take the time to work out a more specific type to use.
392
393@item integer
394The value must be an integer, and is represented textually
395in the customization buffer.
396
397@item number
398The value must be a number, and is represented textually in the
399customization buffer.
400
401@item string
402The value must be a string, and the customization buffer shows just the
403contents, with no @samp{"} characters or quoting with @samp{\}.
404
405@item regexp
406The value must be a string which is a valid regular expression.
407
408@item character
409The value must be a character code. A character code is actually an
410integer, but this type shows the value by inserting the character in the
411buffer, rather than by showing the number.
412
413@item file
414The value must be a file name, and you can do completion with
415@kbd{M-@key{TAB}}.
416
417@item (file :must-match t)
418The value must be a file name for an existing file, and you can do
419completion with @kbd{M-@key{TAB}}.
420
421@item directory
422The value must be a directory name, and you can do completion with
423@kbd{M-@key{TAB}}.
424
425@item symbol
426The value must be a symbol. It appears in the customization buffer as
427the name of the symbol.
428
429@item function
430The value must be either a lambda expression or a function name. When
431it is a function name, you can do completion with @kbd{M-@key{TAB}}.
432
433@item variable
434The value must be a variable name, and you can do completion with
435@kbd{M-@key{TAB}}.
436
437@item boolean
438The value is boolean---either @code{nil} or @code{t}.
439@end table
440
441@node Composite Types
442@subsection Composite Types
443
444 When none of the simple types is appropriate, you can use composite
445types, which build from simple types. Here are several ways of doing
446that:
447
448@table @code
449@item (restricted-sexp :match-alternatives @var{criteria})
450The value may be any Lisp object that satisfies one of @var{criteria}.
451@var{criteria} should be a list, and each elements should be
452one of these possibilities:
453
454@itemize @bullet
455@item
456A predicate---that is, a function of one argument that returns non-@code{nil}
457if the argument fits a certain type. This means that objects of that type
458are acceptable.
459
460@item
461A quoted constant---that is, @code{'@var{object}}. This means that
462@var{object} is an acceptable value.
463@end itemize
464
465For example,
466
467@example
468(restricted-sexp :match-alternatives (integerp 't 'nil))
469@end example
470
471@noindent
472allows integers, @code{t} and @code{nil} as legitimate values.
473
474The customization buffer shows all legitimate values using their read
475syntax, and the user edits them textually.
476
477@item (cons @var{car-type} @var{cdr-type})
478The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
479its @sc{cdr} must fit @var{cdr-type}. For example, @code{(const string
480symbol)} is a customization type which matches values such as
481@code{("foo" . foo)}.
482
483In the customization buffeer, the @sc{car} and the @sc{cdr} are
484displayed and edited separately, each according to the type
485that you specify for it.
486
487@item (list @var{element-types}@dots{})
488The value must be a list with exactly as many elements as the
489@var{element-types} you have specified; and each element must fit the
490corresponding @var{element-type}.
491
492For example, @code{(list integer string function)} describes a list of
493three elements; the first element must be an integer, the second a
494string, and the third a function.
495
496In the customization buffeer, the each element is displayed and edited
497separately, according to the type specified for it.
498
499@item (vector @var{element-types}@dots{})
500Like @code{list} except that the value must be a vector instead of a
501list. The elements work the same as in @code{list}.
502
503@item (choice @var{alternative-types}...)
504The value must fit at least one of @var{alternative-types}.
505For example, @code{(choice integer string)} allows either an
506integer or a string.
507
508In the customization buffer, the user selects one of the alternatives
509using a menu, and can then edit the value in the usual way for that
510alternative.
511
512Normally the strings in this menu are determined automatically from the
513choices; however, you can specify different strings for the menu by
514including the @code{:tag} keyword in the alternatives. For example, if
515an integer stands for a number of spaces, while a string is text to use
516verbatim, you might write the customization type this way,
517
518@smallexample
519(choice (integer :tag "Number of spaces")
520 (string :tag "Literal text"))
521@end smallexample
522
523@noindent
524so that the menu offers @samp{Number of spaces} and @samp{Literal Text}.
525
526@item (const @var{value})
527The value must be @var{value}---nothing else is allowed.
528
529The main use of @code{const} is inside of @code{choice}. For example,
530@code{(choice integer (const nil))} allows either an integer or
531@code{nil}. @code{:tag} is often used with @code{const}.
532
533@item (function-item @var{function})
534Like @code{const}, but used for values which are functions. This
535displays the documentation string of the function @var{function}
536as well as its name.
537
538@item (variable-item @var{variable})
539Like @code{const}, but used for values which are variable names. This
540displays the documentation string of the variable @var{variable} as well
541as its name.
542
543@item (set @var{elements}@dots{})
544The value must be a list and each element of the list must be one of the
545@var{elements} specified. This appears in the customization buffer as a
546checklist.
547
548@item (repeat @var{element-type})
549The value must be a list and each element of the list must fit the type
550@var{element-type}. This appears in the customization buffer as a
551list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding
552more elements or removing elements.
553@end table
554
555@node Splicing into Lists
556@subsection Splicing into Lists
557
558 The @code{:inline} feature lets you splice a variable number of
559elements into the middle of a list or vector. You use it in a
560@code{set}, @code{choice} or @code{repeat} type which appears among the
561element-types of a @code{list} or @code{vector}.
562
563 Normally, each of the element-types in a @code{list} or @code{vector}
564describes one and only one element of the list or vector. Thus, if an
565element-type is a @code{repeat}, that specifies a list of unspecified
566length which appears as one element.
567
568 But when the element-type uses @code{:inline}, the value it matches is
569merged directly into the containing sequence. For example, if it
570matches a list with three elements, those become three elements of the
571overall sequence. This is analogous to using @samp{,@@} in the backquote
572construct.
573
574 For example, to specify a list whose first element must be @code{t}
575and whose remaining arguments should be zero or more of @code{foo} and
576@code{bar}, use this customization type:
577
578@example
579(list (const t) (set :inline t foo bar))
580@end example
581
582@noindent
583This matches values such as @code{(t)}, @code{(t foo)}, @code{(t bar)}
584and @code{(t foo bar)}.
585
586 When the element-type is a @code{choice}, you use @code{:inline} not
587in the @code{choice} itself, but in (some of) the alternatives of the
588@code{choice}. For example, to match a list which must start with a
589file name, followed either by the symbol @code{t} or two strings, use
590this customization type:
591
592@example
593(list file
594 (choice (const t)
595 (list :inline t string string)))
596@end example
597
598@noindent
599If the user chooses the first alternative in the choice, then the
600overall list has two elements and the second element is @code{t}. If
601the user chooses the second alternative, then the overall list has three
602elements and the second and third must be strings.
603
604@node Type Keywords
605@subsection Type Keywords
606
607You can specify keyword-argument pairs in a customization type after the
608type name symbol. Here are the keywords you can use, and their
609meanings:
610
611@table @code
612@item :value @var{default}
613This is used for a type that appears as an alternative inside of
614@code{:choice}; it specifies the default value to use, at first, if and
615when the user selects this alternative with the menu in the
616customization buffer.
617
618Of course, if the actual value of the option fits this alternative, it
619will appear showing the actual value, not @var{default}.
620
621@item :format @var{format-string}
622This string will be inserted in the buffer to represent the value
623corresponding to the type. The following @samp{%} escapes are available
624for use in @var{format-string}:
625
626@table @samp
627@ignore
628@item %[@var{button}%]
629Display the text @var{button} marked as a button. The @code{:action}
630attribute specifies what the button will do if the user invokes it;
631its value is a function which takes two arguments---the widget which
632the button appears in, and the event.
633
634There is no way to specify two different buttons with different
635actions; but perhaps there is no need for one.
636@end ignore
637
638@item %@{@var{sample}%@}
639Show @var{sample} in a special face specified by @code{:sample-face}.
640
641@item %v
642Substitute the item's value. How the value is represented depends on
643the kind of item, and (for variables) on the customization type.
644
645@item %d
646Substitute the item's documentation string.
647
648@item %h
649Like @samp{%d}, but if the documentation string is more than one line,
650add an active field to control whether to show all of it or just the
651first line.
652
653@item %t
654Substitute the tag here. You specify the tag with the @code{:tag}
655keyword.
656
657@item %%
658Display a literal @samp{%}.
659@end table
660
661@item :button-face @var{face}
662Use face @var{face} for text displayed with @samp{%[@dots{}%]}.
663
664@item :button-prefix
665@itemx :button-suffix
666These specify the text to display before and after a button.
667Each can be:
668
669@table @asis
670@item @code{nil}
671No text is inserted.
672
673@item a string
674The string is inserted literally.
675
676@item a symbol
677The symbol's value is used.
678@end table
679
680@item :doc @var{doc}
681Use @var{doc} as the documentation string for this item.
682
683@item :tag @var{tag}
684Use @var{tag} (a string) as the tag for this item.
685
686@item :help-echo @var{motion-doc}
687When you move to this item with @code{widget-forward} or
688@code{widget-backward}, it will display the string @var{motion-doc}
689in the echo area.
690
691@item :match @var{function}
692Specify how to decide whether a value matches the type. @var{function}
693should be a function that accepts two arguments, a widget and a value;
694it should return non-@code{nil} if the value is acceptable.
695
696@ignore
697@item :indent @var{columns}
698Indent this item by @var{columns} columns. The indentation is used for
699@samp{%n}, and automatically for group names, for checklists and radio
700buttons, and for editable lists. It affects the whole of the
701item except for the first line.
702
703@item :offset @var{columns}
704An integer indicating how many extra spaces to indent the subitems of
705this item. By default, subitems are indented the same as their parent.
706
707@item :extra-offset
708An integer indicating how many extra spaces to add to this item's
709indentation, compared to its parent.
710
711@item :notify
712A function called each time the item or a subitem is changed. The
713function is called with two or three arguments. The first argument is
714the item itself, the second argument is the item that was changed, and
715the third argument is the event leading to the change, if any.
716
717@item :menu-tag
718Tag used in the menu when the widget is used as an option in a
719@code{menu-choice} widget.
720
721@item :menu-tag-get
722Function used for finding the tag when the widget is used as an option
723in a @code{menu-choice} widget. By default, the tag used will be either the
724@code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
725representation of the @code{:value} property if not.
726
727@item :validate
728A function which takes a widget as an argument, and return nil if the
729widgets current value is valid for the widget. Otherwise, it should
730return the widget containing the invalid data, and set that widgets
731@code{:error} property to a string explaining the error.
732
733You can use the function @code{widget-children-validate} for this job;
734it tests that all children of @var{widget} are valid.
735
736@item :tab-order
737Specify the order in which widgets are traversed with
738@code{widget-forward} or @code{widget-backward}. This is only partially
739implemented.
740
741@enumerate a
742@item
743Widgets with tabbing order @code{-1} are ignored.
744
745@item
746(Unimplemented) When on a widget with tabbing order @var{n}, go to the
747next widget in the buffer with tabbing order @var{n+1} or @code{nil},
748whichever comes first.
749
750@item
751When on a widget with no tabbing order specified, go to the next widget
752in the buffer with a positive tabbing order, or @code{nil}
753@end enumerate
754
755@item :parent
756The parent of a nested widget (e.g. a @code{menu-choice} item or an
757element of a @code{editable-list} widget).
758
759@item :sibling-args
760This keyword is only used for members of a @code{radio-button-choice} or
761@code{checklist}. The value should be a list of extra keyword
762arguments, which will be used when creating the @code{radio-button} or
763@code{checkbox} associated with this item.
764@end ignore
765@end table
diff --git a/lispref/nonascii.texi b/lispref/nonascii.texi
new file mode 100644
index 00000000000..16a22f2c443
--- /dev/null
+++ b/lispref/nonascii.texi
@@ -0,0 +1,691 @@
1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1998 Free Software Foundation, Inc.
4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/characters
6@node Non-ASCII Characters, Searching and Matching, Text, Top
7@chapter Non-ASCII Characters
8@cindex multibyte characters
9@cindex non-ASCII characters
10
11 This chapter covers the special issues relating to non-@sc{ASCII}
12characters and how they are stored in strings and buffers.
13
14@menu
15* Text Representations::
16* Converting Representations::
17* Selecting a Representation::
18* Character Codes::
19* Character Sets::
20* Scanning Charsets::
21* Chars and Bytes::
22* Coding Systems::
23* Default Coding Systems::
24* Specifying Coding Systems::
25* Explicit Encoding::
26@end menu
27
28@node Text Representations
29@section Text Representations
30@cindex text representations
31
32 Emacs has two @dfn{text representations}---two ways to represent text
33in a string or buffer. These are called @dfn{unibyte} and
34@dfn{multibyte}. Each string, and each buffer, uses one of these two
35representations. For most purposes, you can ignore the issue of
36representations, because Emacs converts text between them as
37appropriate. Occasionally in Lisp programming you will need to pay
38attention to the difference.
39
40@cindex unibyte text
41 In unibyte representation, each character occupies one byte and
42therefore the possible character codes range from 0 to 255. Codes 0
43through 127 are @sc{ASCII} characters; the codes from 128 through 255
44are used for one non-@sc{ASCII} character set (you can choose which one
45by setting the variable @code{nonascii-insert-offset}).
46
47@cindex leading code
48@cindex multibyte text
49 In multibyte representation, a character may occupy more than one
50byte, and as a result, the full range of Emacs character codes can be
51stored. The first byte of a multibyte character is always in the range
52128 through 159 (octal 0200 through 0237). These values are called
53@dfn{leading codes}. The first byte determines which character set the
54character belongs to (@pxref{Character Sets}); in particular, it
55determines how many bytes long the sequence is. The second and
56subsequent bytes of a multibyte character are always in the range 160
57through 255 (octal 0240 through 0377).
58
59 In a buffer, the buffer-local value of the variable
60@code{enable-multibyte-characters} specifies the representation used.
61The representation for a string is determined based on the string
62contents when the string is constructed.
63
64@tindex enable-multibyte-characters
65@defvar enable-multibyte-characters
66This variable specifies the current buffer's text representation.
67If it is non-@code{nil}, the buffer contains multibyte text; otherwise,
68it contains unibyte text.
69
70@strong{Warning:} do not set this variable directly; instead, use the
71function @code{set-buffer-multibyte} to change a buffer's
72representation.
73@end defvar
74
75@tindex default-enable-multibyte-characters
76@defvar default-enable-multibyte-characters
77This variable`s value is entirely equivalent to @code{(default-value
78'enable-multibyte-characters)}, and setting this variable changes that
79default value. Although setting the local binding of
80@code{enable-multibyte-characters} in a specific buffer is dangerous,
81changing the default value is safe, and it is a reasonable thing to do.
82
83The @samp{--unibyte} command line option does its job by setting the
84default value to @code{nil} early in startup.
85@end defvar
86
87@tindex multibyte-string-p
88@defun multibyte-string-p string
89Return @code{t} if @var{string} contains multibyte characters.
90@end defun
91
92@node Converting Representations
93@section Converting Text Representations
94
95 Emacs can convert unibyte text to multibyte; it can also convert
96multibyte text to unibyte, though this conversion loses information. In
97general these conversions happen when inserting text into a buffer, or
98when putting text from several strings together in one string. You can
99also explicitly convert a string's contents to either representation.
100
101 Emacs chooses the representation for a string based on the text that
102it is constructed from. The general rule is to convert unibyte text to
103multibyte text when combining it with other multibyte text, because the
104multibyte representation is more general and can hold whatever
105characters the unibyte text has.
106
107 When inserting text into a buffer, Emacs converts the text to the
108buffer's representation, as specified by
109@code{enable-multibyte-characters} in that buffer. In particular, when
110you insert multibyte text into a unibyte buffer, Emacs converts the text
111to unibyte, even though this conversion cannot in general preserve all
112the characters that might be in the multibyte text. The other natural
113alternative, to convert the buffer contents to multibyte, is not
114acceptable because the buffer's representation is a choice made by the
115user that cannot simply be overrided.
116
117 Converting unibyte text to multibyte text leaves @sc{ASCII} characters
118unchanged. It converts the non-@sc{ASCII} codes 128 through 255 by
119adding the value @code{nonascii-insert-offset} to each character code.
120By setting this variable, you specify which character set the unibyte
121characters correspond to. For example, if @code{nonascii-insert-offset}
122is 2048, which is @code{(- (make-char 'latin-iso8859-1 0) 128)}, then
123the unibyte non-@sc{ASCII} characters correspond to Latin 1. If it is
1242688, which is @code{(- (make-char 'greek-iso8859-7 0) 128)}, then they
125correspond to Greek letters.
126
127 Converting multibyte text to unibyte is simpler: it performs
128logical-and of each character code with 255. If
129@code{nonascii-insert-offset} has a reasonable value, corresponding to
130the beginning of some character set, this conversion is the inverse of
131the other: converting unibyte text to multibyte and back to unibyte
132reproduces the original unibyte text.
133
134@tindex nonascii-insert-offset
135@defvar nonascii-insert-offset
136This variable specifies the amount to add to a non-@sc{ASCII} character
137when converting unibyte text to multibyte. It also applies when
138@code{insert-char} or @code{self-insert-command} inserts a character in
139the unibyte non-@sc{ASCII} range, 128 through 255.
140
141The right value to use to select character set @var{cs} is @code{(-
142(make-char @var{cs} 0) 128)}. If the value of
143@code{nonascii-insert-offset} is zero, then conversion actually uses the
144value for the Latin 1 character set, rather than zero.
145@end defvar
146
147@tindex nonascii-translate-table
148@defvar nonascii-translate-table
149This variable provides a more general alternative to
150@code{nonascii-insert-offset}. You can use it to specify independently
151how to translate each code in the range of 128 through 255 into a
152multibyte character. The value should be a vector, or @code{nil}.
153@end defvar
154
155@tindex string-make-unibyte
156@defun string-make-unibyte string
157This function converts the text of @var{string} to unibyte
158representation, if it isn't already, and return the result. If
159conversion does not change the contents, the value may be @var{string}
160itself.
161@end defun
162
163@tindex string-make-multibyte
164@defun string-make-multibyte string
165This function converts the text of @var{string} to multibyte
166representation, if it isn't already, and return the result. If
167conversion does not change the contents, the value may be @var{string}
168itself.
169@end defun
170
171@node Selecting a Representation
172@section Selecting a Representation
173
174 Sometimes it is useful to examine an existing buffer or string as
175multibyte when it was unibyte, or vice versa.
176
177@tindex set-buffer-multibyte
178@defun set-buffer-multibyte multibyte
179Set the representation type of the current buffer. If @var{multibyte}
180is non-@code{nil}, the buffer becomes multibyte. If @var{multibyte}
181is @code{nil}, the buffer becomes unibyte.
182
183This function leaves the buffer contents unchanged when viewed as a
184sequence of bytes. As a consequence, it can change the contents viewed
185as characters; a sequence of two bytes which is treated as one character
186in multibyte representation will count as two characters in unibyte
187representation.
188
189This function sets @code{enable-multibyte-characters} to record which
190representation is in use. It also adjusts various data in the buffer
191(including its overlays, text properties and markers) so that they
192cover or fall between the same text as they did before.
193@end defun
194
195@tindex string-as-unibyte
196@defun string-as-unibyte string
197This function returns a string with the same bytes as @var{string} but
198treating each byte as a character. This means that the value may have
199more characters than @var{string} has.
200
201If @var{string} is unibyte already, then the value may be @var{string}
202itself.
203@end defun
204
205@tindex string-as-multibyte
206@defun string-as-multibyte string
207This function returns a string with the same bytes as @var{string} but
208treating each multibyte sequence as one character. This means that the
209value may have fewer characters than @var{string} has.
210
211If @var{string} is multibyte already, then the value may be @var{string}
212itself.
213@end defun
214
215@node Character Codes
216@section Character Codes
217@cindex character codes
218
219 The unibyte and multibyte text representations use different character
220codes. The valid character codes for unibyte representation range from
2210 to 255---the values that can fit in one byte. The valid character
222codes for multibyte representation range from 0 to 524287, but not all
223values in that range are valid. In particular, the values 128 through
224255 are not valid in multibyte text. Only the @sc{ASCII} codes 0
225through 127 are used in both representations.
226
227@defun char-valid-p charcode
228This returns @code{t} if @var{charcode} is valid for either one of the two
229text representations.
230
231@example
232(char-valid-p 65)
233 @result{} t
234(char-valid-p 256)
235 @result{} nil
236(char-valid-p 2248)
237 @result{} t
238@end example
239@end defun
240
241@node Character Sets
242@section Character Sets
243@cindex character sets
244
245 Emacs classifies characters into various @dfn{character sets}, each of
246which has a name which is a symbol. Each character belongs to one and
247only one character set.
248
249 In general, there is one character set for each distinct script. For
250example, @code{latin-iso8859-1} is one character set,
251@code{greek-iso8859-7} is another, and @code{ascii} is another. An
252Emacs character set can hold at most 9025 characters; therefore. in some
253cases, a set of characters that would logically be grouped together are
254split into several character sets. For example, one set of Chinese
255characters is divided into eight Emacs character sets,
256@code{chinese-cns11643-1} through @code{chinese-cns11643-7}.
257
258@tindex charsetp
259@defun charsetp object
260Return @code{t} if @var{object} is a character set name symbol,
261@code{nil} otherwise.
262@end defun
263
264@tindex charset-list
265@defun charset-list
266This function returns a list of all defined character set names.
267@end defun
268
269@tindex char-charset
270@defun char-charset character
271This function returns the the name of the character
272set that @var{character} belongs to.
273@end defun
274
275@node Scanning Charsets
276@section Scanning for Character Sets
277
278 Sometimes it is useful to find out which character sets appear in a
279part of a buffer or a string. One use for this is in determining which
280coding systems (@pxref{Coding Systems}) are capable of representing all
281of the text in question.
282
283@tindex find-charset-region
284@defun find-charset-region beg end &optional unification
285This function returns a list of the character sets
286that appear in the current buffer between positions @var{beg}
287and @var{end}.
288@end defun
289
290@tindex find-charset-string
291@defun find-charset-string string &optional unification
292This function returns a list of the character sets
293that appear in the string @var{string}.
294@end defun
295
296@node Chars and Bytes
297@section Characters and Bytes
298@cindex bytes and characters
299
300 In multibyte representation, each character occupies one or more
301bytes. The functions in this section convert between characters and the
302byte values used to represent them.
303
304@tindex char-bytes
305@defun char-bytes character
306This function returns the number of bytes used to represent the
307character @var{character}. In most cases, this is the same as
308@code{(length (split-char @var{character}))}; the only exception is for
309ASCII characters, which use just one byte.
310
311@example
312(char-bytes 2248)
313 @result{} 2
314(char-bytes 65)
315 @result{} 1
316@end example
317
318This function's values are correct for both multibyte and unibyte
319representations, because the non-@sc{ASCII} character codes used in
320those two representations do not overlap.
321
322@example
323(char-bytes 192)
324 @result{} 1
325@end example
326@end defun
327
328@tindex split-char
329@defun split-char character
330Return a list containing the name of the character set of
331@var{character}, followed by one or two byte-values which identify
332@var{character} within that character set.
333
334@example
335(split-char 2248)
336 @result{} (latin-iso8859-1 72)
337(split-char 65)
338 @result{} (ascii 65)
339@end example
340
341Unibyte non-@sc{ASCII} characters are considered as part of
342the @code{ascii} character set:
343
344@example
345(split-char 192)
346 @result{} (ascii 192)
347@end example
348@end defun
349
350@tindex make-char
351@defun make-char charset &rest byte-values
352Thus function returns the character in character set @var{charset}
353identified by @var{byte-values}. This is roughly the opposite of
354split-char.
355
356@example
357(make-char 'latin-iso8859-1 72)
358 @result{} 2248
359@end example
360@end defun
361
362@node Coding Systems
363@section Coding Systems
364
365@cindex coding system
366 When Emacs reads or writes a file, and when Emacs sends text to a
367subprocess or receives text from a subprocess, it normally performs
368character code conversion and end-of-line conversion as specified
369by a particular @dfn{coding system}.
370
371@cindex character code conversion
372 @dfn{Character code conversion} involves conversion between the encoding
373used inside Emacs and some other encoding. Emacs supports many
374different encodings, in that it can convert to and from them. For
375example, it can convert text to or from encodings such as Latin 1, Latin
3762, Latin 3, Latin 4, Latin 5, and several variants of ISO 2022. In some
377cases, Emacs supports several alternative encodings for the same
378characters; for example, there are three coding systems for the Cyrillic
379(Russian) alphabet: ISO, Alternativnyj, and KOI8.
380
381@cindex end of line conversion
382 @dfn{End of line conversion} handles three different conventions used
383on various systems for end of line. The Unix convention is to use the
384linefeed character (also called newline). The DOS convention is to use
385the two character sequence, carriage-return linefeed, at the end of a
386line. The Mac convention is to use just carriage-return.
387
388 Most coding systems specify a particular character code for
389conversion, but some of them leave this unspecified---to be chosen
390heuristically based on the data.
391
392@cindex base coding system
393@cindex variant coding system
394 @dfn{Base coding systems} such as @code{latin-1} leave the end-of-line
395conversion unspecified, to be chosen based on the data. @dfn{Variant
396coding systems} such as @code{latin-1-unix}, @code{latin-1-dos} and
397@code{latin-1-mac} specify the end-of-line conversion explicitly as
398well. Each base coding system has three corresponding variants whose
399names are formed by adding @samp{-unix}, @samp{-dos} and @samp{-mac}.
400
401 Here are Lisp facilities for working with coding systems;
402
403@tindex coding-system-list
404@defun coding-system-list &optional base-only
405This function returns a list of all coding system names (symbols). If
406@var{base-only} is non-@code{nil}, the value includes only the
407base coding systems. Otherwise, it includes variant coding systems as well.
408@end defun
409
410@tindex coding-system-p
411@defun coding-system-p object
412This function returns @code{t} if @var{object} is a coding system
413name.
414@end defun
415
416@tindex check-coding-system
417@defun check-coding-system coding-system
418This function checks the validity of @var{coding-system}.
419If that is valid, it returns @var{coding-system}.
420Otherwise it signals an error with condition @code{coding-system-error}.
421@end defun
422
423@tindex detect-coding-region
424@defun detect-coding-region start end highest
425This function chooses a plausible coding system for decoding the text
426from @var{start} to @var{end}. This text should be ``raw bytes''
427(@pxref{Specifying Coding Systems}).
428
429Normally this function returns is a list of coding systems that could
430handle decoding the text that was scanned. They are listed in order of
431decreasing priority, based on the priority specified by the user with
432@code{prefer-coding-system}. But if @var{highest} is non-@code{nil},
433then the return value is just one coding system, the one that is highest
434in priority.
435@end defun
436
437@tindex detect-coding-string string highest
438@defun detect-coding-string
439This function is like @code{detect-coding-region} except that it
440operates on the contents of @var{string} instead of bytes in the buffer.
441@end defun
442
443@defun find-operation-coding-system operation &rest arguments
444This function returns the coding system to use (by default) for
445performing @var{operation} with @var{arguments}. The value has this
446form:
447
448@example
449(@var{decoding-system} @var{encoding-system})
450@end example
451
452The first element, @var{decoding-system}, is the coding system to use
453for decoding (in case @var{operation} does decoding), and
454@var{encoding-system} is the coding system for encoding (in case
455@var{operation} does encoding).
456
457The argument @var{operation} should be an Emacs I/O primitive:
458@code{insert-file-contents}, @code{write-region}, @code{call-process},
459@code{call-process-region}, @code{start-process}, or
460@code{open-network-stream}.
461
462The remaining arguments should be the same arguments that might be given
463to that I/O primitive. Depending on which primitive, one of those
464arguments is selected as the @dfn{target}. For example, if
465@var{operation} does file I/O, whichever argument specifies the file
466name is the target. For subprocess primitives, the process name is the
467target. For @code{open-network-stream}, the target is the service name
468or port number.
469
470This function looks up the target in @code{file-coding-system-alist},
471@code{process-coding-system-alist}, or
472@code{network-coding-system-alist}, depending on @var{operation}.
473@xref{Default Coding Systems}.
474@end defun
475
476@node Default Coding Systems
477@section Default Coding Systems
478
479 These variable specify which coding system to use by default for
480certain files or when running certain subprograms. The idea of these
481variables is that you set them once and for all to the defaults you
482want, and then do not change them again. To specify a particular coding
483system for a particular operation, don't change these variables;
484instead, override them using @code{coding-system-for-read} and
485@code{coding-system-for-write} (@pxref{Specifying Coding Systems}).
486
487@tindex file-coding-system-alist
488@defvar file-coding-system-alist
489This variable is an alist that specifies the coding systems to use for
490reading and writing particular files. Each element has the form
491@code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular
492expression that matches certain file names. The element applies to file
493names that match @var{pattern}.
494
495The @sc{cdr} of the element, @var{val}, should be either a coding
496system, a cons cell containing two coding systems, or a function symbol.
497If @var{val} is a coding system, that coding system is used for both
498reading the file and writing it. If @var{val} is a cons cell containing
499two coding systems, its @sc{car} specifies the coding system for
500decoding, and its @sc{cdr} specifies the coding system for encoding.
501
502If @var{val} is a function symbol, the function must return a coding
503system or a cons cell containing two coding systems. This value is used
504as described above.
505@end defvar
506
507@tindex process-coding-system-alist
508@defvar process-coding-system-alist
509This variable is an alist specifying which coding systems to use for a
510subprocess, depending on which program is running in the subprocess. It
511works like @code{file-coding-system-alist}, except that @var{pattern} is
512matched against the program name used to start the subprocess. The coding
513system or systems specified in this alist are used to initialize the
514coding systems used for I/O to the subprocess, but you can specify
515other coding systems later using @code{set-process-coding-system}.
516@end defvar
517
518@tindex network-coding-system-alist
519@defvar network-coding-system-alist
520This variable is an alist that specifies the coding system to use for
521network streams. It works much like @code{file-coding-system-alist},
522with the difference that the @var{pattern} in an elemetn may be either a
523port number or a regular expression. If it is a regular expression, it
524is matched against the network service name used to open the network
525stream.
526@end defvar
527
528@tindex default-process-coding-system
529@defvar default-process-coding-system
530This variable specifies the coding systems to use for subprocess (and
531network stream) input and output, when nothing else specifies what to
532do.
533
534The value should be a cons cell of the form @code{(@var{output-coding}
535. @var{input-coding})}. Here @var{output-coding} applies to output to
536the subprocess, and @var{input-coding} applies to input from it.
537@end defvar
538
539@node Specifying Coding Systems
540@section Specifying a Coding System for One Operation
541
542 You can specify the coding system for a specific operation by binding
543the variables @code{coding-system-for-read} and/or
544@code{coding-system-for-write}.
545
546@tindex coding-system-for-read
547@defvar coding-system-for-read
548If this variable is non-@code{nil}, it specifies the coding system to
549use for reading a file, or for input from a synchronous subprocess.
550
551It also applies to any asynchronous subprocess or network stream, but in
552a different way: the value of @code{coding-system-for-read} when you
553start the subprocess or open the network stream specifies the input
554decoding method for that subprocess or network stream. It remains in
555use for that subprocess or network stream unless and until overridden.
556
557The right way to use this variable is to bind it with @code{let} for a
558specific I/O operation. Its global value is normally @code{nil}, and
559you should not globally set it to any other value. Here is an example
560of the right way to use the variable:
561
562@example
563;; @r{Read the file with no character code conversion.}
564;; @r{Assume CRLF represents end-of-line.}
565(let ((coding-system-for-write 'emacs-mule-dos))
566 (insert-file-contents filename))
567@end example
568
569When its value is non-@code{nil}, @code{coding-system-for-read} takes
570precedence all other methods of specifying a coding system to use for
571input, including @code{file-coding-system-alist},
572@code{process-coding-system-alist} and
573@code{network-coding-system-alist}.
574@end defvar
575
576@tindex coding-system-for-write
577@defvar coding-system-for-write
578This works much like @code{coding-system-for-read}, except that it
579applies to output rather than input. It affects writing to files,
580subprocesses, and net connections.
581
582When a single operation does both input and output, as do
583@code{call-process-region} and @code{start-process}, both
584@code{coding-system-for-read} and @code{coding-system-for-write}
585affect it.
586@end defvar
587
588@tindex last-coding-system-used
589@defvar last-coding-system-used
590All operations that use a coding system set this variable
591to the coding system name that was used.
592@end defvar
593
594@tindex inhibit-eol-conversion
595@defvar inhibit-eol-conversion
596When this variable is non-@code{nil}, no end-of-line conversion is done,
597no matter which coding system is specified. This applies to all the
598Emacs I/O and subprocess primitives, and to the explicit encoding and
599decoding functions (@pxref{Explicit Encoding}).
600@end defvar
601
602@tindex keyboard-coding-system
603@defun keyboard-coding-system
604This function returns the coding system that is in use for decoding
605keyboard input---or @code{nil} if no coding system is to be used.
606@end defun
607
608@tindex set-keyboard-coding-system
609@defun set-keyboard-coding-system coding-system
610This function specifies @var{coding-system} as the coding system to
611use for decoding keyboard input. If @var{coding-system} is @code{nil},
612that means do not decode keyboard input.
613@end defun
614
615@tindex terminal-coding-system
616@defun terminal-coding-system
617This function returns the coding system that is in use for encoding
618terminal output---or @code{nil} for no encoding.
619@end defun
620
621@tindex set-terminal-coding-system
622@defun set-terminal-coding-system coding-system
623This function specifies @var{coding-system} as the coding system to use
624for encoding terminal output. If @var{coding-system} is @code{nil},
625that means do not encode terminal output.
626@end defun
627
628 See also the functions @code{process-coding-system} and
629@code{set-process-coding-system}. @xref{Process Information}.
630
631 See also @code{read-coding-system} in @ref{High-Level Completion}.
632
633@node Explicit Encoding
634@section Explicit Encoding and Decoding
635@cindex encoding text
636@cindex decoding text
637
638 All the operations that transfer text in and out of Emacs have the
639ability to use a coding system to encode or decode the text.
640You can also explicitly encode and decode text using the functions
641in this section.
642
643@cindex raw bytes
644 The result of encoding, and the input to decoding, are not ordinary
645text. They are ``raw bytes''---bytes that represent text in the same
646way that an external file would. When a buffer contains raw bytes, it
647is most natural to mark that buffer as using unibyte representation,
648using @code{set-buffer-multibyte} (@pxref{Selecting a Representation}),
649but this is not required.
650
651 The usual way to get raw bytes in a buffer, for explicit decoding, is
652to read them with from a file with @code{insert-file-contents-literally}
653(@pxref{Reading from Files}) or specify a non-@code{nil} @var{rawfile}
654arguments when visiting a file with @code{find-file-noselect}.
655
656 The usual way to use the raw bytes that result from explicitly
657encoding text is to copy them to a file or process---for example, to
658write it with @code{write-region} (@pxref{Writing to Files}), and
659suppress encoding for that @code{write-region} call by binding
660@code{coding-system-for-write} to @code{no-conversion}.
661
662@tindex encode-coding-region
663@defun encode-coding-region start end coding-system
664This function encodes the text from @var{start} to @var{end} according
665to coding system @var{coding-system}. The encoded text replaces
666the original text in the buffer. The result of encoding is
667``raw bytes.''
668@end defun
669
670@tindex encode-coding-string
671@defun encode-coding-string string coding-system
672This function encodes the text in @var{string} according to coding
673system @var{coding-system}. It returns a new string containing the
674encoded text. The result of encoding is ``raw bytes.''
675@end defun
676
677@tindex decode-coding-region
678@defun decode-coding-region start end coding-system
679This function decodes the text from @var{start} to @var{end} according
680to coding system @var{coding-system}. The decoded text replaces the
681original text in the buffer. To make explicit decoding useful, the text
682before decoding ought to be ``raw bytes.''
683@end defun
684
685@tindex decode-coding-string
686@defun decode-coding-string string coding-system
687This function decodes the text in @var{string} according to coding
688system @var{coding-system}. It returns a new string containing the
689decoded text. To make explicit decoding useful, the contents of
690@var{string} ought to be ``raw bytes.''
691@end defun