diff options
| -rw-r--r-- | doc/lispref/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/lispref/nonascii.texi | 62 |
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 @@ | |||
| 1 | 2009-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 | |||
| 1 | 2009-05-09 Martin Rudalics <rudalics@gmx.at> | 8 | 2009-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 |
| 1005 | This function returns a list of all coding system names (symbols). If | 1006 | This 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 | |||
| 1013 | name or @code{nil}. | 1014 | name 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 |
| 1017 | This function checks the validity of @var{coding-system}. If that is | 1020 | This function checks the validity of @var{coding-system}. If that is |
| 1018 | valid, it returns @var{coding-system}. If @var{coding-system} is | 1021 | valid, 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 |
| 1025 | This function returns the type of end-of-line (a.k.a.@: @dfn{eol}) | 1029 | This function returns the type of end-of-line (a.k.a.@: @dfn{eol}) |
| 1026 | conversion used by @var{coding-system}. If @var{coding-system} | 1030 | conversion used by @var{coding-system}. If @var{coding-system} |
| @@ -1047,6 +1051,7 @@ taken from the appropriate default coding system (e.g., | |||
| 1047 | appropriate for the underlying platform. | 1051 | appropriate 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 |
| 1051 | This function returns a coding system which is like @var{coding-system} | 1056 | This function returns a coding system which is like @var{coding-system} |
| 1052 | except for its eol conversion, which is specified by @code{eol-type}. | 1057 | except 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 |
| 1062 | This function returns a coding system which uses the end-of-line | 1068 | This function returns a coding system which uses the end-of-line |
| 1063 | conversion of @var{eol-coding}, and the text conversion of | 1069 | conversion 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 |
| 1069 | This function returns a list of coding systems that could be used to | 1077 | This function returns a list of coding systems that could be used to |
| 1070 | encode a text between @var{from} and @var{to}. All coding systems in | 1078 | encode 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 | |||
| 1075 | list @code{(undecided)}. | 1083 | list @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 |
| 1079 | This function returns a list of coding systems that could be used to | 1089 | This function returns a list of coding systems that could be used to |
| 1080 | encode the text of @var{string}. All coding systems in the list can | 1090 | encode 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 |
| 1087 | This function returns a list of coding systems that could be used to | 1099 | This function returns a list of coding systems that could be used to |
| 1088 | encode all the character sets in the list @var{charsets}. | 1100 | encode all the character sets in the list @var{charsets}. |
| @@ -1130,6 +1142,7 @@ This function is like @code{detect-coding-region} except that it | |||
| 1130 | operates on the contents of @var{string} instead of bytes in the buffer. | 1142 | operates 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 |
| 1134 | If this variable has a non-@code{nil} value, null bytes are ignored | 1147 | If this variable has a non-@code{nil} value, null bytes are ignored |
| 1135 | when detecting the encoding of a region or a string. This allows to | 1148 | when 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. | |||
| 1146 | because many files in the Emacs distribution use ISO-2022 encoding.} | 1159 | because 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 |
| 1150 | This function returns the list of character sets (@pxref{Character | 1164 | This function returns the list of character sets (@pxref{Character |
| 1151 | Sets}) supported by @var{coding-system}. Some coding systems that | 1165 | Sets}) 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 |
| 1260 | system for certain files or when running certain subprograms, and the | 1276 | system 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 |
| 1271 | This variable is an alist of text patterns and corresponding coding | 1288 | This variable is an alist of text patterns and corresponding coding |
| 1272 | systems. Each element has the form @code{(@var{regexp} | 1289 | systems. Each element has the form @code{(@var{regexp} |
| @@ -1279,6 +1296,7 @@ so that Emacs automatically recognizes mail files in Babyl format and | |||
| 1279 | reads them with no code conversions. | 1296 | reads 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 |
| 1283 | This variable is an alist that specifies the coding systems to use for | 1301 | This variable is an alist that specifies the coding systems to use for |
| 1284 | reading and writing particular files. Each element has the form | 1302 | reading 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 | ||
| 1326 | This variable is an alist that specifies the coding systems to use for | ||
| 1327 | reading and writing particular files. Its form is like that of | ||
| 1328 | @code{file-coding-system-alist}, but, unlike the latter, this variable | ||
| 1329 | takes 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 |
| 1308 | This variable is an alist specifying which coding systems to use for a | 1334 | This variable is an alist specifying which coding systems to use for a |
| 1309 | subprocess, depending on which program is running in the subprocess. It | 1335 | subprocess, depending on which program is running in the subprocess. It |
| @@ -1327,6 +1353,8 @@ coding system which determines both the character code conversion and | |||
| 1327 | the end of line conversion---that is, one like @code{latin-1-unix}, | 1353 | the end of line conversion---that is, one like @code{latin-1-unix}, |
| 1328 | rather than @code{undecided} or @code{latin-1}. | 1354 | rather 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 |
| 1331 | This variable is an alist that specifies the coding system to use for | 1359 | This variable is an alist that specifies the coding system to use for |
| 1332 | network streams. It works much like @code{file-coding-system-alist}, | 1360 | network 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} | |||
| 1346 | the subprocess, and @var{output-coding} applies to output to it. | 1374 | the 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 |
| 1350 | This variable holds a list of functions that try to determine a | 1379 | This variable holds a list of functions that try to determine a |
| 1351 | coding system for a file based on its undecoded contents. | 1380 | coding 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 | |||
| 1362 | functions won't be called. | 1391 | functions won't be called. |
| 1363 | @end defvar | 1392 | @end defvar |
| 1364 | 1393 | ||
| 1394 | @defun find-auto-coding filename size | ||
| 1395 | This function tries to determine a suitable coding system for | ||
| 1396 | @var{filename}. It examines the buffer visiting the named file, using | ||
| 1397 | the variables documented above in sequence, until it finds a match for | ||
| 1398 | one of the rules specified by these variables. It then returns a cons | ||
| 1399 | cell of the form @code{(@var{coding} . @var{source})}, where | ||
| 1400 | @var{coding} is the coding system to use and @var{source} is a symbol, | ||
| 1401 | one of @code{auto-coding-alist}, @code{auto-coding-regexp-alist}, | ||
| 1402 | @code{:coding}, or @code{auto-coding-functions}, indicating which one | ||
| 1403 | supplied the matching rule. The value @code{:coding} means the coding | ||
| 1404 | system was specified by the @code{coding:} tag in the file | ||
| 1405 | (@pxref{Specify Coding,, coding tag, emacs, The GNU Emacs Manual}). | ||
| 1406 | The order of looking for a matching rule is @code{auto-coding-alist} | ||
| 1407 | first, then @code{auto-coding-regexp-alist}, then the @code{coding:} | ||
| 1408 | tag, and lastly @code{auto-coding-functions}. If no matching rule was | ||
| 1409 | found, the function returns @code{nil}. | ||
| 1410 | |||
| 1411 | The second argument @var{size} is the size of text, in characters, | ||
| 1412 | following point. The function examines text only within @var{size} | ||
| 1413 | characters after point. Normally, the buffer should be positioned at | ||
| 1414 | the beginning when this function is called, because one of the places | ||
| 1415 | for the @code{coding:} tag is the first one or two lines of the file; | ||
| 1416 | in that case, @var{size} should be the size of the buffer. | ||
| 1417 | @end defun | ||
| 1418 | |||
| 1419 | @defun set-auto-coding filename size | ||
| 1420 | This function returns a suitable coding system for file | ||
| 1421 | @var{filename}. It uses @code{find-auto-coding} to find the coding | ||
| 1422 | system. 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 |
| 1366 | This function returns the coding system to use (by default) for | 1428 | This function returns the coding system to use (by default) for |
| 1367 | performing @var{operation} with @var{arguments}. The value has this | 1429 | performing @var{operation} with @var{arguments}. The value has this |