aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog7
-rw-r--r--doc/lispref/nonascii.texi62
2 files changed, 69 insertions, 0 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index aa16c5d180b..f4596416bb2 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,10 @@
12009-05-09 Eli Zaretskii <eliz@gnu.org>
2
3 * nonascii.texi (Default Coding Systems): Document
4 find-auto-coding, set-auto-coding, and auto-coding-alist. Add
5 indexing.
6 (Lisp and Coding Systems): Add index entries.
7
12009-05-09 Martin Rudalics <rudalics@gmx.at> 82009-05-09 Martin Rudalics <rudalics@gmx.at>
2 9
3 * windows.texi (Choosing Window): Describe split-window-sensibly 10 * windows.texi (Choosing Window): Describe split-window-sensibly
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 818cc096b83..5a7c3f117a9 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -1001,6 +1001,7 @@ new file name for that buffer.
1001 1001
1002 Here are the Lisp facilities for working with coding systems: 1002 Here are the Lisp facilities for working with coding systems:
1003 1003
1004@cindex list all coding systems
1004@defun coding-system-list &optional base-only 1005@defun coding-system-list &optional base-only
1005This function returns a list of all coding system names (symbols). If 1006This function returns a list of all coding system names (symbols). If
1006@var{base-only} is non-@code{nil}, the value includes only the 1007@var{base-only} is non-@code{nil}, the value includes only the
@@ -1013,6 +1014,8 @@ This function returns @code{t} if @var{object} is a coding system
1013name or @code{nil}. 1014name or @code{nil}.
1014@end defun 1015@end defun
1015 1016
1017@cindex validity of coding system
1018@cindex coding system, validity check
1016@defun check-coding-system coding-system 1019@defun check-coding-system coding-system
1017This function checks the validity of @var{coding-system}. If that is 1020This function checks the validity of @var{coding-system}. If that is
1018valid, it returns @var{coding-system}. If @var{coding-system} is 1021valid, it returns @var{coding-system}. If @var{coding-system} is
@@ -1021,6 +1024,7 @@ signals an error whose @code{error-symbol} is @code{coding-system-error}
1021(@pxref{Signaling Errors, signal}). 1024(@pxref{Signaling Errors, signal}).
1022@end defun 1025@end defun
1023 1026
1027@cindex eol type of coding system
1024@defun coding-system-eol-type coding-system 1028@defun coding-system-eol-type coding-system
1025This function returns the type of end-of-line (a.k.a.@: @dfn{eol}) 1029This function returns the type of end-of-line (a.k.a.@: @dfn{eol})
1026conversion used by @var{coding-system}. If @var{coding-system} 1030conversion used by @var{coding-system}. If @var{coding-system}
@@ -1047,6 +1051,7 @@ taken from the appropriate default coding system (e.g.,
1047appropriate for the underlying platform. 1051appropriate for the underlying platform.
1048@end defun 1052@end defun
1049 1053
1054@cindex eol conversion of coding system
1050@defun coding-system-change-eol-conversion coding-system eol-type 1055@defun coding-system-change-eol-conversion coding-system eol-type
1051This function returns a coding system which is like @var{coding-system} 1056This function returns a coding system which is like @var{coding-system}
1052except for its eol conversion, which is specified by @code{eol-type}. 1057except for its eol conversion, which is specified by @code{eol-type}.
@@ -1058,6 +1063,7 @@ the end-of-line conversion from the data.
1058@code{dos} and @code{mac}, respectively. 1063@code{dos} and @code{mac}, respectively.
1059@end defun 1064@end defun
1060 1065
1066@cindex text conversion of coding system
1061@defun coding-system-change-text-conversion eol-coding text-coding 1067@defun coding-system-change-text-conversion eol-coding text-coding
1062This function returns a coding system which uses the end-of-line 1068This function returns a coding system which uses the end-of-line
1063conversion of @var{eol-coding}, and the text conversion of 1069conversion of @var{eol-coding}, and the text conversion of
@@ -1065,6 +1071,8 @@ conversion of @var{eol-coding}, and the text conversion of
1065@code{undecided}, or one of its variants according to @var{eol-coding}. 1071@code{undecided}, or one of its variants according to @var{eol-coding}.
1066@end defun 1072@end defun
1067 1073
1074@cindex safely encode region
1075@cindex coding systems for encoding region
1068@defun find-coding-systems-region from to 1076@defun find-coding-systems-region from to
1069This function returns a list of coding systems that could be used to 1077This function returns a list of coding systems that could be used to
1070encode a text between @var{from} and @var{to}. All coding systems in 1078encode a text between @var{from} and @var{to}. All coding systems in
@@ -1075,6 +1083,8 @@ If the text contains no multibyte characters, the function returns the
1075list @code{(undecided)}. 1083list @code{(undecided)}.
1076@end defun 1084@end defun
1077 1085
1086@cindex safely encode a string
1087@cindex coding systems for encoding a string
1078@defun find-coding-systems-string string 1088@defun find-coding-systems-string string
1079This function returns a list of coding systems that could be used to 1089This function returns a list of coding systems that could be used to
1080encode the text of @var{string}. All coding systems in the list can 1090encode the text of @var{string}. All coding systems in the list can
@@ -1083,6 +1093,8 @@ contains no multibyte characters, this returns the list
1083@code{(undecided)}. 1093@code{(undecided)}.
1084@end defun 1094@end defun
1085 1095
1096@cindex charset, coding systems to encode
1097@cindex safely encode characters in a charset
1086@defun find-coding-systems-for-charsets charsets 1098@defun find-coding-systems-for-charsets charsets
1087This function returns a list of coding systems that could be used to 1099This function returns a list of coding systems that could be used to
1088encode all the character sets in the list @var{charsets}. 1100encode all the character sets in the list @var{charsets}.
@@ -1130,6 +1142,7 @@ This function is like @code{detect-coding-region} except that it
1130operates on the contents of @var{string} instead of bytes in the buffer. 1142operates on the contents of @var{string} instead of bytes in the buffer.
1131@end defun 1143@end defun
1132 1144
1145@cindex null bytes, and decoding text
1133@defvar inhibit-null-byte-detection 1146@defvar inhibit-null-byte-detection
1134If this variable has a non-@code{nil} value, null bytes are ignored 1147If this variable has a non-@code{nil} value, null bytes are ignored
1135when detecting the encoding of a region or a string. This allows to 1148when detecting the encoding of a region or a string. This allows to
@@ -1146,6 +1159,7 @@ encoding, and all escape sequences become visible in a buffer.
1146because many files in the Emacs distribution use ISO-2022 encoding.} 1159because many files in the Emacs distribution use ISO-2022 encoding.}
1147@end defvar 1160@end defvar
1148 1161
1162@cindex charsets supported by a coding system
1149@defun coding-system-charset-list coding-system 1163@defun coding-system-charset-list coding-system
1150This function returns the list of character sets (@pxref{Character 1164This function returns the list of character sets (@pxref{Character
1151Sets}) supported by @var{coding-system}. Some coding systems that 1165Sets}) supported by @var{coding-system}. Some coding systems that
@@ -1255,6 +1269,8 @@ the user tries to enter null input, it asks the user to try again.
1255 1269
1256@node Default Coding Systems 1270@node Default Coding Systems
1257@subsection Default Coding Systems 1271@subsection Default Coding Systems
1272@cindex default coding system
1273@cindex coding system, automatically determined
1258 1274
1259 This section describes variables that specify the default coding 1275 This section describes variables that specify the default coding
1260system for certain files or when running certain subprograms, and the 1276system for certain files or when running certain subprograms, and the
@@ -1267,6 +1283,7 @@ don't change these variables; instead, override them using
1267@code{coding-system-for-read} and @code{coding-system-for-write} 1283@code{coding-system-for-read} and @code{coding-system-for-write}
1268(@pxref{Specifying Coding Systems}). 1284(@pxref{Specifying Coding Systems}).
1269 1285
1286@cindex file contents, and default coding system
1270@defvar auto-coding-regexp-alist 1287@defvar auto-coding-regexp-alist
1271This variable is an alist of text patterns and corresponding coding 1288This variable is an alist of text patterns and corresponding coding
1272systems. Each element has the form @code{(@var{regexp} 1289systems. Each element has the form @code{(@var{regexp}
@@ -1279,6 +1296,7 @@ so that Emacs automatically recognizes mail files in Babyl format and
1279reads them with no code conversions. 1296reads them with no code conversions.
1280@end defvar 1297@end defvar
1281 1298
1299@cindex file name, and default coding system
1282@defvar file-coding-system-alist 1300@defvar file-coding-system-alist
1283This variable is an alist that specifies the coding systems to use for 1301This variable is an alist that specifies the coding systems to use for
1284reading and writing particular files. Each element has the form 1302reading and writing particular files. Each element has the form
@@ -1304,6 +1322,14 @@ If @var{coding} (or what returned by the above function) is
1304@code{undecided}, the normal code-detection is performed. 1322@code{undecided}, the normal code-detection is performed.
1305@end defvar 1323@end defvar
1306 1324
1325@defvar auto-coding-alist
1326This variable is an alist that specifies the coding systems to use for
1327reading and writing particular files. Its form is like that of
1328@code{file-coding-system-alist}, but, unlike the latter, this variable
1329takes priority over any @code{coding:} tags in the file.
1330@end defvar
1331
1332@cindex program name, and default coding system
1307@defvar process-coding-system-alist 1333@defvar process-coding-system-alist
1308This variable is an alist specifying which coding systems to use for a 1334This variable is an alist specifying which coding systems to use for a
1309subprocess, depending on which program is running in the subprocess. It 1335subprocess, depending on which program is running in the subprocess. It
@@ -1327,6 +1353,8 @@ coding system which determines both the character code conversion and
1327the end of line conversion---that is, one like @code{latin-1-unix}, 1353the end of line conversion---that is, one like @code{latin-1-unix},
1328rather than @code{undecided} or @code{latin-1}. 1354rather than @code{undecided} or @code{latin-1}.
1329 1355
1356@cindex port number, and default coding system
1357@cindex network service name, and default coding system
1330@defvar network-coding-system-alist 1358@defvar network-coding-system-alist
1331This variable is an alist that specifies the coding system to use for 1359This variable is an alist that specifies the coding system to use for
1332network streams. It works much like @code{file-coding-system-alist}, 1360network streams. It works much like @code{file-coding-system-alist},
@@ -1346,6 +1374,7 @@ The value should be a cons cell of the form @code{(@var{input-coding}
1346the subprocess, and @var{output-coding} applies to output to it. 1374the subprocess, and @var{output-coding} applies to output to it.
1347@end defvar 1375@end defvar
1348 1376
1377@cindex default coding system, functions to determine
1349@defvar auto-coding-functions 1378@defvar auto-coding-functions
1350This variable holds a list of functions that try to determine a 1379This variable holds a list of functions that try to determine a
1351coding system for a file based on its undecoded contents. 1380coding system for a file based on its undecoded contents.
@@ -1362,6 +1391,39 @@ If a file has a @samp{coding:} tag, that takes precedence, so these
1362functions won't be called. 1391functions won't be called.
1363@end defvar 1392@end defvar
1364 1393
1394@defun find-auto-coding filename size
1395This function tries to determine a suitable coding system for
1396@var{filename}. It examines the buffer visiting the named file, using
1397the variables documented above in sequence, until it finds a match for
1398one of the rules specified by these variables. It then returns a cons
1399cell of the form @code{(@var{coding} . @var{source})}, where
1400@var{coding} is the coding system to use and @var{source} is a symbol,
1401one of @code{auto-coding-alist}, @code{auto-coding-regexp-alist},
1402@code{:coding}, or @code{auto-coding-functions}, indicating which one
1403supplied the matching rule. The value @code{:coding} means the coding
1404system was specified by the @code{coding:} tag in the file
1405(@pxref{Specify Coding,, coding tag, emacs, The GNU Emacs Manual}).
1406The order of looking for a matching rule is @code{auto-coding-alist}
1407first, then @code{auto-coding-regexp-alist}, then the @code{coding:}
1408tag, and lastly @code{auto-coding-functions}. If no matching rule was
1409found, the function returns @code{nil}.
1410
1411The second argument @var{size} is the size of text, in characters,
1412following point. The function examines text only within @var{size}
1413characters after point. Normally, the buffer should be positioned at
1414the beginning when this function is called, because one of the places
1415for the @code{coding:} tag is the first one or two lines of the file;
1416in that case, @var{size} should be the size of the buffer.
1417@end defun
1418
1419@defun set-auto-coding filename size
1420This function returns a suitable coding system for file
1421@var{filename}. It uses @code{find-auto-coding} to find the coding
1422system. If no coding system could be determined, the function returns
1423@code{nil}. The meaning of the argument @var{size} is like in
1424@code{find-auto-coding}.
1425@end defun
1426
1365@defun find-operation-coding-system operation &rest arguments 1427@defun find-operation-coding-system operation &rest arguments
1366This function returns the coding system to use (by default) for 1428This function returns the coding system to use (by default) for
1367performing @var{operation} with @var{arguments}. The value has this 1429performing @var{operation} with @var{arguments}. The value has this