comparison lispref/nonascii.texi @ 53291:04d2bf306bd2

Various small changes in addition to the following. (Converting Representations): Clarify behavior of `string-make-multibyte' and `string-to-multibyte' for unibyte all ASCII arguments. (Character Sets): Document the variable `charset-list' and adapt the definition of the function `charset-list' accordingly. (Translation of Characters): Clarify use of generic characters in `make-translation-table'. Clarify and correct the description of the use of translation tables in encoding and decoding. (User-Chosen Coding Systems): Correct and clarify the description of `select-safe-coding-system'. (Default Coding Systems): Clarify description of `file-coding-system-alist'.
author Luc Teirlinck <teirllm@auburn.edu>
date Thu, 25 Dec 2003 03:34:38 +0000
parents 1a5c50faf357
children ad4360363d82
comparison
equal deleted inserted replaced
53288:4cb33bfb540c 53291:04d2bf306bd2
94 @end defvar 94 @end defvar
95 95
96 @defun position-bytes position 96 @defun position-bytes position
97 @tindex position-bytes 97 @tindex position-bytes
98 Return the byte-position corresponding to buffer position @var{position} 98 Return the byte-position corresponding to buffer position @var{position}
99 in the current buffer. 99 in the current buffer. If @var{position} is out of range, the value
100 is @code{nil}.
100 @end defun 101 @end defun
101 102
102 @defun byte-to-position byte-position 103 @defun byte-to-position byte-position
103 @tindex byte-to-position 104 @tindex byte-to-position
104 Return the buffer position corresponding to byte-position 105 Return the buffer position corresponding to byte-position
105 @var{byte-position} in the current buffer. 106 @var{byte-position} in the current buffer. If @var{byte-position} is
107 out of range, the value is @code{nil}.
106 @end defun 108 @end defun
107 109
108 @defun multibyte-string-p string 110 @defun multibyte-string-p string
109 Return @code{t} if @var{string} is a multibyte string. 111 Return @code{t} if @var{string} is a multibyte string.
110 @end defun 112 @end defun
171 how to translate each code in the range of 128 through 255 into a 173 how to translate each code in the range of 128 through 255 into a
172 multibyte character. The value should be a char-table, or @code{nil}. 174 multibyte character. The value should be a char-table, or @code{nil}.
173 If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}. 175 If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}.
174 @end defvar 176 @end defvar
175 177
178 The next three functions either return the argument @var{string}, or a
179 newly created string with no text properties.
180
176 @defun string-make-unibyte string 181 @defun string-make-unibyte string
177 This function converts the text of @var{string} to unibyte 182 This function converts the text of @var{string} to unibyte
178 representation, if it isn't already, and returns the result. If 183 representation, if it isn't already, and returns the result. If
179 @var{string} is a unibyte string, it is returned unchanged. Multibyte 184 @var{string} is a unibyte string, it is returned unchanged. Multibyte
180 character codes are converted to unibyte according to 185 character codes are converted to unibyte according to
184 @end defun 189 @end defun
185 190
186 @defun string-make-multibyte string 191 @defun string-make-multibyte string
187 This function converts the text of @var{string} to multibyte 192 This function converts the text of @var{string} to multibyte
188 representation, if it isn't already, and returns the result. If 193 representation, if it isn't already, and returns the result. If
189 @var{string} is a multibyte string, it is returned unchanged. 194 @var{string} is a multibyte string or consists entirely of
190 The function @code{unibyte-char-to-multibyte} is used to convert 195 @acronym{ASCII} characters, it is returned unchanged. In particular,
191 each unibyte character to a multibyte character. 196 if @var{string} is unibyte and entirely @acronym{ASCII}, the returned
197 string is unibyte. (When the characters are all @acronym{ASCII},
198 Emacs primitives will treat the string the same way whether it is
199 unibyte or multibyte.) If @var{string} is unibyte and contains
200 non-@acronym{ASCII} characters, the function
201 @code{unibyte-char-to-multibyte} is used to convert each unibyte
202 character to a multibyte character.
192 @end defun 203 @end defun
193 204
194 @defun string-to-multibyte string 205 @defun string-to-multibyte string
195 This function returns a multibyte string containing the same sequence 206 This function returns a multibyte string containing the same sequence
196 of character codes as @var{string}. If @var{string} is a multibyte 207 of character codes as @var{string}. Unlike
197 string, the value is the equal to @var{string}. 208 @code{string-make-multibyte}, this function unconditionally returns a
209 multibyte string. If @var{string} is a multibyte string, it is
210 returned unchanged.
198 @end defun 211 @end defun
199 212
200 @node Selecting a Representation 213 @node Selecting a Representation
201 @section Selecting a Representation 214 @section Selecting a Representation
202 215
278 (char-valid-p 2248) 291 (char-valid-p 2248)
279 @result{} t 292 @result{} t
280 @end example 293 @end example
281 294
282 If the optional argument @var{genericp} is non-@code{nil}, this 295 If the optional argument @var{genericp} is non-@code{nil}, this
283 function returns @code{t} if @var{charcode} is a generic character 296 function also returns @code{t} if @var{charcode} is a generic
284 (@pxref{Splitting Characters}). 297 character (@pxref{Splitting Characters}).
285 @end defun 298 @end defun
286 299
287 @node Character Sets 300 @node Character Sets
288 @section Character Sets 301 @section Character Sets
289 @cindex character sets 302 @cindex character sets
309 @defun charsetp object 322 @defun charsetp object
310 Returns @code{t} if @var{object} is a symbol that names a character set, 323 Returns @code{t} if @var{object} is a symbol that names a character set,
311 @code{nil} otherwise. 324 @code{nil} otherwise.
312 @end defun 325 @end defun
313 326
327 @defvar charset-list
328 The value is a list of all defined character set names.
329 @end defvar
330
314 @defun charset-list 331 @defun charset-list
315 This function returns a list of all defined character set names. 332 This function returns the value of @code{charset-list}. It is only
333 provided for backward compatibility.
316 @end defun 334 @end defun
317 335
318 @defun char-charset character 336 @defun char-charset character
319 This function returns the name of the character set that @var{character} 337 This function returns the name of the character set that @var{character}
320 belongs to. 338 belongs to, or the symbol @code{unknown} if @var{character} is not a
339 valid character.
321 @end defun 340 @end defun
322 341
323 @defun charset-plist charset 342 @defun charset-plist charset
324 @tindex charset-plist 343 @tindex charset-plist
325 This function returns the charset property list of the character set 344 This function returns the charset property list of the character set
376 Return a list containing the name of the character set of 395 Return a list containing the name of the character set of
377 @var{character}, followed by one or two byte values (integers) which 396 @var{character}, followed by one or two byte values (integers) which
378 identify @var{character} within that character set. The number of byte 397 identify @var{character} within that character set. The number of byte
379 values is the character set's dimension. 398 values is the character set's dimension.
380 399
400 If @var{character} is invalid as a character code, @code{split-char}
401 returns a list consisting of the symbol @code{unknown} and @var{character}.
402
381 @example 403 @example
382 (split-char 2248) 404 (split-char 2248)
383 @result{} (latin-iso8859-1 72) 405 @result{} (latin-iso8859-1 72)
384 (split-char 65) 406 (split-char 65)
385 @result{} (ascii 65) 407 @result{} (ascii 65)
461 @node Translation of Characters 483 @node Translation of Characters
462 @section Translation of Characters 484 @section Translation of Characters
463 @cindex character translation tables 485 @cindex character translation tables
464 @cindex translation tables 486 @cindex translation tables
465 487
466 A @dfn{translation table} specifies a mapping of characters 488 A @dfn{translation table} is a char-table that specifies a mapping
467 into characters. These tables are used in encoding and decoding, and 489 of characters into characters. These tables are used in encoding and
468 for other purposes. Some coding systems specify their own particular 490 decoding, and for other purposes. Some coding systems specify their
469 translation tables; there are also default translation tables which 491 own particular translation tables; there are also default translation
470 apply to all other coding systems. 492 tables which apply to all other coding systems.
471 493
472 @defun make-translation-table &rest translations 494 @defun make-translation-table &rest translations
473 This function returns a translation table based on the argument 495 This function returns a translation table based on the argument
474 @var{translations}. Each element of @var{translations} should be a 496 @var{translations}. Each element of @var{translations} should be a
475 list of elements of the form @code{(@var{from} . @var{to})}; this says 497 list of elements of the form @code{(@var{from} . @var{to})}; this says
481 @var{to-alt}. 503 @var{to-alt}.
482 504
483 You can also map one whole character set into another character set with 505 You can also map one whole character set into another character set with
484 the same dimension. To do this, you specify a generic character (which 506 the same dimension. To do this, you specify a generic character (which
485 designates a character set) for @var{from} (@pxref{Splitting Characters}). 507 designates a character set) for @var{from} (@pxref{Splitting Characters}).
486 In this case, @var{to} should also be a generic character, for another 508 In this case, if @var{to} is also a generic character, its character
487 character set of the same dimension. Then the translation table 509 set should have the same dimension as @var{from}'s. Then the
488 translates each character of @var{from}'s character set into the 510 translation table translates each character of @var{from}'s character
489 corresponding character of @var{to}'s character set. 511 set into the corresponding character of @var{to}'s character set. If
512 @var{from} is a generic character and @var{to} is an ordinary
513 character, then the translation table translates every character of
514 @var{from}'s character set into @var{to}.
490 @end defun 515 @end defun
491 516
492 In decoding, the translation table's translations are applied to the 517 In decoding, the translation table's translations are applied to the
493 characters that result from ordinary decoding. If a coding system has 518 characters that result from ordinary decoding. If a coding system has
494 property @code{character-translation-table-for-decode}, that specifies 519 property @code{translation-table-for-decode}, that specifies the
495 the translation table to use. Otherwise, if 520 translation table to use. (This is a property of the coding system,
496 @code{standard-translation-table-for-decode} is non-@code{nil}, decoding 521 as returned by @code{coding-system-get}, not a property of the symbol
497 uses that table. 522 that is the coding system's name. @xref{Coding System Basics,, Basic
523 Concepts of Coding Systems}.) Otherwise, if
524 @code{standard-translation-table-for-decode} is non-@code{nil},
525 decoding uses that table.
498 526
499 In encoding, the translation table's translations are applied to the 527 In encoding, the translation table's translations are applied to the
500 characters in the buffer, and the result of translation is actually 528 characters in the buffer, and the result of translation is actually
501 encoded. If a coding system has property 529 encoded. If a coding system has property
502 @code{character-translation-table-for-encode}, that specifies the 530 @code{translation-table-for-encode}, that specifies the translation
503 translation table to use. Otherwise the variable 531 table to use. Otherwise the variable
504 @code{standard-translation-table-for-encode} specifies the translation 532 @code{standard-translation-table-for-encode} specifies the translation
505 table. 533 table.
506 534
507 @defvar standard-translation-table-for-decode 535 @defvar standard-translation-table-for-decode
508 This is the default translation table for decoding, for 536 This is the default translation table for decoding, for
514 coding systems that don't specify any other translation table. 542 coding systems that don't specify any other translation table.
515 @end defvar 543 @end defvar
516 544
517 @defvar translation-table-for-input 545 @defvar translation-table-for-input
518 Self-inserting characters are translated through this translation 546 Self-inserting characters are translated through this translation
519 table before they are inserted. 547 table before they are inserted. This variable automatically becomes
548 buffer-local when set.
520 @end defvar 549 @end defvar
521 550
522 @node Coding Systems 551 @node Coding Systems
523 @section Coding Systems 552 @section Coding Systems
524 553
684 systems as well. 713 systems as well.
685 @end defun 714 @end defun
686 715
687 @defun coding-system-p object 716 @defun coding-system-p object
688 This function returns @code{t} if @var{object} is a coding system 717 This function returns @code{t} if @var{object} is a coding system
689 name. 718 name or @code{nil}.
690 @end defun 719 @end defun
691 720
692 @defun check-coding-system coding-system 721 @defun check-coding-system coding-system
693 This function checks the validity of @var{coding-system}. 722 This function checks the validity of @var{coding-system}.
694 If that is valid, it returns @var{coding-system}. 723 If that is valid, it returns @var{coding-system}.
699 This function returns a coding system which is like @var{coding-system} 728 This function returns a coding system which is like @var{coding-system}
700 except for its eol conversion, which is specified by @code{eol-type}. 729 except for its eol conversion, which is specified by @code{eol-type}.
701 @var{eol-type} should be @code{unix}, @code{dos}, @code{mac}, or 730 @var{eol-type} should be @code{unix}, @code{dos}, @code{mac}, or
702 @code{nil}. If it is @code{nil}, the returned coding system determines 731 @code{nil}. If it is @code{nil}, the returned coding system determines
703 the end-of-line conversion from the data. 732 the end-of-line conversion from the data.
733
734 @var{eol-type} may also be 0, 1 or 2, standing for @code{unix},
735 @code{dos} and @code{mac}, respectively.
704 @end defun 736 @end defun
705 737
706 @defun coding-system-change-text-conversion eol-coding text-coding 738 @defun coding-system-change-text-conversion eol-coding text-coding
707 This function returns a coding system which uses the end-of-line 739 This function returns a coding system which uses the end-of-line
708 conversion of @var{eol-coding}, and the text conversion of 740 conversion of @var{eol-coding}, and the text conversion of
743 decreasing priority. But if @var{highest} is non-@code{nil}, then the 775 decreasing priority. But if @var{highest} is non-@code{nil}, then the
744 return value is just one coding system, the one that is highest in 776 return value is just one coding system, the one that is highest in
745 priority. 777 priority.
746 778
747 If the region contains only @acronym{ASCII} characters, the value 779 If the region contains only @acronym{ASCII} characters, the value
748 is @code{undecided} or @code{(undecided)}. 780 is @code{undecided} or @code{(undecided)}, or a variant specifying
749 @end defun 781 end-of-line conversion, if that can be deduced from the text.
750 782 @end defun
751 @defun detect-coding-string string highest 783
784 @defun detect-coding-string string &optional highest
752 This function is like @code{detect-coding-region} except that it 785 This function is like @code{detect-coding-region} except that it
753 operates on the contents of @var{string} instead of bytes in the buffer. 786 operates on the contents of @var{string} instead of bytes in the buffer.
754 @end defun 787 @end defun
755 788
756 @xref{Process Information}, for how to examine or set the coding 789 @xref{Coding systems for a subprocess,, Process Information}, in
757 systems used for I/O to a subprocess. 790 particular the description of the functions
791 @code{process-coding-system} and @code{set-process-coding-system}, for
792 how to examine or set the coding systems used for I/O to a subprocess.
758 793
759 @node User-Chosen Coding Systems 794 @node User-Chosen Coding Systems
760 @subsection User-Chosen Coding Systems 795 @subsection User-Chosen Coding Systems
761 796
762 @cindex select safe coding system 797 @cindex select safe coding system
763 @defun select-safe-coding-system from to &optional default-coding-system accept-default-p 798 @defun select-safe-coding-system from to &optional default-coding-system accept-default-p file
764 This function selects a coding system for encoding specified text, 799 This function selects a coding system for encoding specified text,
765 asking the user to choose if necessary. Normally the specified text 800 asking the user to choose if necessary. Normally the specified text
766 is the text in the current buffer between @var{from} and @var{to}, 801 is the text in the current buffer between @var{from} and @var{to}. If
767 defaulting to the whole buffer if they are @code{nil}. If @var{from} 802 @var{from} is a string, the string specifies the text to encode, and
768 is a string, the string specifies the text to encode, and @var{to} is 803 @var{to} is ignored.
769 ignored.
770 804
771 If @var{default-coding-system} is non-@code{nil}, that is the first 805 If @var{default-coding-system} is non-@code{nil}, that is the first
772 coding system to try; if that can handle the text, 806 coding system to try; if that can handle the text,
773 @code{select-safe-coding-system} returns that coding system. It can 807 @code{select-safe-coding-system} returns that coding system. It can
774 also be a list of coding systems; then the function tries each of them 808 also be a list of coding systems; then the function tries each of them
775 one by one. After trying all of them, it next tries the user's most 809 one by one. After trying all of them, it next tries the current
776 preferred coding system (@pxref{Recognize Coding, 810 buffer's value of @code{buffer-file-coding-system} (if it is not
777 prefer-coding-system, the description of @code{prefer-coding-system}, 811 @code{undecided}), then the value of
778 emacs, GNU Emacs Manual}), and after that the current buffer's value 812 @code{default-buffer-file-coding-system} and finally the user's most
779 of @code{buffer-file-coding-system} (if it is not @code{undecided}). 813 preferred coding system, which the user can set using the command
814 @code{prefer-coding-system} (@pxref{Recognize Coding,, Recognizing
815 Coding Systems, emacs, The GNU Emacs Manual}).
780 816
781 If one of those coding systems can safely encode all the specified 817 If one of those coding systems can safely encode all the specified
782 text, @code{select-safe-coding-system} chooses it and returns it. 818 text, @code{select-safe-coding-system} chooses it and returns it.
783 Otherwise, it asks the user to choose from a list of coding systems 819 Otherwise, it asks the user to choose from a list of coding systems
784 which can encode all the text, and returns the user's choice. 820 which can encode all the text, and returns the user's choice.
785 821
822 @var{default-coding-system} can also be a list whose first element is
823 t and whose other elements are coding systems. Then, if no coding
824 system in the list can handle the text, @code{select-safe-coding-system}
825 queries the user immediately, without trying any of the three
826 alternatives described above.
827
786 The optional argument @var{accept-default-p}, if non-@code{nil}, 828 The optional argument @var{accept-default-p}, if non-@code{nil},
787 should be a function to determine whether the coding system selected 829 should be a function to determine whether a coding system selected
788 without user interaction is acceptable. If this function returns 830 without user interaction is acceptable. @code{select-safe-coding-system}
789 @code{nil}, the silently selected coding system is rejected, and the 831 calls this function with one argument, the base coding system of the
790 user is asked to select a coding system from a list of possible 832 selected coding system. If @var{accept-default-p} returns @code{nil},
791 candidates. 833 @code{select-safe-coding-system} rejects the silently selected coding
834 system, and asks the user to select a coding system from a list of
835 possible candidates.
792 836
793 @vindex select-safe-coding-system-accept-default-p 837 @vindex select-safe-coding-system-accept-default-p
794 If the variable @code{select-safe-coding-system-accept-default-p} is 838 If the variable @code{select-safe-coding-system-accept-default-p} is
795 non-@code{nil}, its value overrides the value of 839 non-@code{nil}, its value overrides the value of
796 @var{accept-default-p}. 840 @var{accept-default-p}.
841
842 As a final step, before returning the chosen coding system,
843 @code{select-safe-coding-system} checks whether that coding system is
844 consistent with what would be selected if the contents of the region
845 were read from a file. (If not, this could lead to data corruption in
846 a file subsequently re-visited and edited.) Normally,
847 @code{select-safe-coding-system} uses @code{buffer-file-name} as the
848 file for this purpose, but if @var{file} is non-@code{nil}, it uses
849 that file instead (this can be relevant for @code{write-region} and
850 similar functions). If it detects an apparent inconsistency,
851 @code{select-safe-coding-system} queries the user before selecting the
852 coding system.
797 @end defun 853 @end defun
798 854
799 Here are two functions you can use to let the user specify a coding 855 Here are two functions you can use to let the user specify a coding
800 system, with completion. @xref{Completion}. 856 system, with completion. @xref{Completion}.
801 857
844 reading and writing particular files. Each element has the form 900 reading and writing particular files. Each element has the form
845 @code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular 901 @code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular
846 expression that matches certain file names. The element applies to file 902 expression that matches certain file names. The element applies to file
847 names that match @var{pattern}. 903 names that match @var{pattern}.
848 904
849 The @acronym{CDR} of the element, @var{coding}, should be either a coding 905 The @sc{cdr} of the element, @var{coding}, should be either a coding
850 system, a cons cell containing two coding systems, or a function name (a 906 system, a cons cell containing two coding systems, or a function name (a
851 symbol with a function definition). If @var{coding} is a coding system, 907 symbol with a function definition). If @var{coding} is a coding system,
852 that coding system is used for both reading the file and writing it. If 908 that coding system is used for both reading the file and writing it. If
853 @var{coding} is a cons cell containing two coding systems, its @acronym{CAR} 909 @var{coding} is a cons cell containing two coding systems, its @sc{car}
854 specifies the coding system for decoding, and its @acronym{cdr} specifies the 910 specifies the coding system for decoding, and its @sc{cdr} specifies the
855 coding system for encoding. 911 coding system for encoding.
856 912
857 If @var{coding} is a function name, the function must return a coding 913 If @var{coding} is a function name, the function should take one
858 system or a cons cell containing two coding systems. This value is used 914 argument, a list of all arguments passed to
859 as described above. 915 @code{find-operation-coding-system}. It must return a coding system
916 or a cons cell containing two coding systems. This value has the same
917 meaning as described above.
860 @end defvar 918 @end defvar
861 919
862 @defvar process-coding-system-alist 920 @defvar process-coding-system-alist
863 This variable is an alist specifying which coding systems to use for a 921 This variable is an alist specifying which coding systems to use for a
864 subprocess, depending on which program is running in the subprocess. It 922 subprocess, depending on which program is running in the subprocess. It
921 This function returns the coding system to use (by default) for 979 This function returns the coding system to use (by default) for
922 performing @var{operation} with @var{arguments}. The value has this 980 performing @var{operation} with @var{arguments}. The value has this
923 form: 981 form:
924 982
925 @example 983 @example
926 (@var{decoding-system} @var{encoding-system}) 984 (@var{decoding-system} . @var{encoding-system})
927 @end example 985 @end example
928 986
929 The first element, @var{decoding-system}, is the coding system to use 987 The first element, @var{decoding-system}, is the coding system to use
930 for decoding (in case @var{operation} does decoding), and 988 for decoding (in case @var{operation} does decoding), and
931 @var{encoding-system} is the coding system for encoding (in case 989 @var{encoding-system} is the coding system for encoding (in case
946 or port number. 1004 or port number.
947 1005
948 This function looks up the target in @code{file-coding-system-alist}, 1006 This function looks up the target in @code{file-coding-system-alist},
949 @code{process-coding-system-alist}, or 1007 @code{process-coding-system-alist}, or
950 @code{network-coding-system-alist}, depending on @var{operation}. 1008 @code{network-coding-system-alist}, depending on @var{operation}.
951 @xref{Default Coding Systems}.
952 @end defun 1009 @end defun
953 1010
954 @node Specifying Coding Systems 1011 @node Specifying Coding Systems
955 @subsection Specifying a Coding System for One Operation 1012 @subsection Specifying a Coding System for One Operation
956 1013
1038 Here are the functions to perform explicit encoding or decoding. The 1095 Here are the functions to perform explicit encoding or decoding. The
1039 decoding functions produce sequences of bytes; the encoding functions 1096 decoding functions produce sequences of bytes; the encoding functions
1040 are meant to operate on sequences of bytes. All of these functions 1097 are meant to operate on sequences of bytes. All of these functions
1041 discard text properties. 1098 discard text properties.
1042 1099
1043 @defun encode-coding-region start end coding-system 1100 @deffn Command encode-coding-region start end coding-system
1044 This function encodes the text from @var{start} to @var{end} according 1101 This command encodes the text from @var{start} to @var{end} according
1045 to coding system @var{coding-system}. The encoded text replaces the 1102 to coding system @var{coding-system}. The encoded text replaces the
1046 original text in the buffer. The result of encoding is logically a 1103 original text in the buffer. The result of encoding is logically a
1047 sequence of bytes, but the buffer remains multibyte if it was multibyte 1104 sequence of bytes, but the buffer remains multibyte if it was multibyte
1048 before. 1105 before.
1049 @end defun 1106
1050 1107 This command returns the length of the encoded text.
1051 @defun encode-coding-string string coding-system 1108 @end deffn
1109
1110 @defun encode-coding-string string coding-system &optional nocopy
1052 This function encodes the text in @var{string} according to coding 1111 This function encodes the text in @var{string} according to coding
1053 system @var{coding-system}. It returns a new string containing the 1112 system @var{coding-system}. It returns a new string containing the
1054 encoded text. The result of encoding is a unibyte string. 1113 encoded text, except when @var{nocopy} is non-@code{nil}, in which
1055 @end defun 1114 case the function may return @var{string} itself if the encoding
1056 1115 operation is trivial. The result of encoding is a unibyte string.
1057 @defun decode-coding-region start end coding-system 1116 @end defun
1058 This function decodes the text from @var{start} to @var{end} according 1117
1118 @deffn Command decode-coding-region start end coding-system
1119 This command decodes the text from @var{start} to @var{end} according
1059 to coding system @var{coding-system}. The decoded text replaces the 1120 to coding system @var{coding-system}. The decoded text replaces the
1060 original text in the buffer. To make explicit decoding useful, the text 1121 original text in the buffer. To make explicit decoding useful, the text
1061 before decoding ought to be a sequence of byte values, but both 1122 before decoding ought to be a sequence of byte values, but both
1062 multibyte and unibyte buffers are acceptable. 1123 multibyte and unibyte buffers are acceptable.
1063 @end defun 1124
1064 1125 This command returns the length of the decoded text.
1065 @defun decode-coding-string string coding-system 1126 @end deffn
1127
1128 @defun decode-coding-string string coding-system &optional nocopy
1066 This function decodes the text in @var{string} according to coding 1129 This function decodes the text in @var{string} according to coding
1067 system @var{coding-system}. It returns a new string containing the 1130 system @var{coding-system}. It returns a new string containing the
1068 decoded text. To make explicit decoding useful, the contents of 1131 decoded text, except when @var{nocopy} is non-@code{nil}, in which
1069 @var{string} ought to be a sequence of byte values, but a multibyte 1132 case the function may return @var{string} itself if the decoding
1133 operation is trivial. To make explicit decoding useful, the contents
1134 of @var{string} ought to be a sequence of byte values, but a multibyte
1070 string is acceptable. 1135 string is acceptable.
1071 @end defun 1136 @end defun
1072 1137
1073 @defun decode-coding-inserted-region from to filename &optional visit beg end replace 1138 @defun decode-coding-inserted-region from to filename &optional visit beg end replace
1074 This function decodes the text from @var{from} to @var{to} as if 1139 This function decodes the text from @var{from} to @var{to} as if
1093 @defun keyboard-coding-system 1158 @defun keyboard-coding-system
1094 This function returns the coding system that is in use for decoding 1159 This function returns the coding system that is in use for decoding
1095 keyboard input---or @code{nil} if no coding system is to be used. 1160 keyboard input---or @code{nil} if no coding system is to be used.
1096 @end defun 1161 @end defun
1097 1162
1098 @defun set-keyboard-coding-system coding-system 1163 @deffn Command set-keyboard-coding-system coding-system
1099 This function specifies @var{coding-system} as the coding system to 1164 This command specifies @var{coding-system} as the coding system to
1100 use for decoding keyboard input. If @var{coding-system} is @code{nil}, 1165 use for decoding keyboard input. If @var{coding-system} is @code{nil},
1101 that means do not decode keyboard input. 1166 that means do not decode keyboard input.
1102 @end defun 1167 @end deffn
1103 1168
1104 @defun terminal-coding-system 1169 @defun terminal-coding-system
1105 This function returns the coding system that is in use for encoding 1170 This function returns the coding system that is in use for encoding
1106 terminal output---or @code{nil} for no encoding. 1171 terminal output---or @code{nil} for no encoding.
1107 @end defun 1172 @end defun
1108 1173
1109 @defun set-terminal-coding-system coding-system 1174 @deffn Command set-terminal-coding-system coding-system
1110 This function specifies @var{coding-system} as the coding system to use 1175 This command specifies @var{coding-system} as the coding system to use
1111 for encoding terminal output. If @var{coding-system} is @code{nil}, 1176 for encoding terminal output. If @var{coding-system} is @code{nil},
1112 that means do not encode terminal output. 1177 that means do not encode terminal output.
1113 @end defun 1178 @end deffn
1114 1179
1115 @node MS-DOS File Types 1180 @node MS-DOS File Types
1116 @subsection MS-DOS File Types 1181 @subsection MS-DOS File Types
1117 @cindex DOS file types 1182 @cindex DOS file types
1118 @cindex MS-DOS file types 1183 @cindex MS-DOS file types
1191 current buffer. (It automatically becomes local in each buffer when set 1256 current buffer. (It automatically becomes local in each buffer when set
1192 in any fashion.) It is @code{nil} if no input method is active in the 1257 in any fashion.) It is @code{nil} if no input method is active in the
1193 buffer now. 1258 buffer now.
1194 @end defvar 1259 @end defvar
1195 1260
1196 @defvar default-input-method 1261 @defopt default-input-method
1197 This variable holds the default input method for commands that choose an 1262 This variable holds the default input method for commands that choose an
1198 input method. Unlike @code{current-input-method}, this variable is 1263 input method. Unlike @code{current-input-method}, this variable is
1199 normally global. 1264 normally global.
1200 @end defvar 1265 @end defopt
1201 1266
1202 @defun set-input-method input-method 1267 @deffn Command set-input-method input-method
1203 This function activates input method @var{input-method} for the current 1268 This command activates input method @var{input-method} for the current
1204 buffer. It also sets @code{default-input-method} to @var{input-method}. 1269 buffer. It also sets @code{default-input-method} to @var{input-method}.
1205 If @var{input-method} is @code{nil}, this function deactivates any input 1270 If @var{input-method} is @code{nil}, this command deactivates any input
1206 method for the current buffer. 1271 method for the current buffer.
1207 @end defun 1272 @end deffn
1208 1273
1209 @defun read-input-method-name prompt &optional default inhibit-null 1274 @defun read-input-method-name prompt &optional default inhibit-null
1210 This function reads an input method name with the minibuffer, prompting 1275 This function reads an input method name with the minibuffer, prompting
1211 with @var{prompt}. If @var{default} is non-@code{nil}, that is returned 1276 with @var{prompt}. If @var{default} is non-@code{nil}, that is returned
1212 by default, if the user enters empty input. However, if 1277 by default, if the user enters empty input. However, if
1238 active. @var{description} is a string describing this method and what 1303 active. @var{description} is a string describing this method and what
1239 it is good for. 1304 it is good for.
1240 @end defvar 1305 @end defvar
1241 1306
1242 The fundamental interface to input methods is through the 1307 The fundamental interface to input methods is through the
1243 variable @code{input-method-function}. @xref{Reading One Event}. 1308 variable @code{input-method-function}. @xref{Reading One Event},
1309 and @ref{Invoking the Input Method}.
1244 1310
1245 @node Locales 1311 @node Locales
1246 @section Locales 1312 @section Locales
1247 @cindex locale 1313 @cindex locale
1248 1314
1292 Return a 12-element vector of month names (locale items @code{MON_1} 1358 Return a 12-element vector of month names (locale items @code{MON_1}
1293 through @code{MON_12}). 1359 through @code{MON_12}).
1294 1360
1295 @item paper 1361 @item paper
1296 Return a list @code{(@var{width} @var{height})} for the default paper 1362 Return a list @code{(@var{width} @var{height})} for the default paper
1297 size measured in milimeters (locale items @code{PAPER_WIDTH} and 1363 size measured in millimeters (locale items @code{PAPER_WIDTH} and
1298 @code{PAPER_HEIGHT}). 1364 @code{PAPER_HEIGHT}).
1299 @end table 1365 @end table
1300 1366
1301 If the system can't provide the requested information, or if 1367 If the system can't provide the requested information, or if
1302 @var{item} is not one of those symbols, the value is @code{nil}. All 1368 @var{item} is not one of those symbols, the value is @code{nil}. All
1303 strings in the return value are decoded using 1369 strings in the return value are decoded using
1304 @code{locale-coding-system}. @xref{Locales,,, libc, GNU Libc Manual}, 1370 @code{locale-coding-system}. @xref{Locales,,, libc, The GNU Libc Manual},
1305 for more information about locales and locale items. 1371 for more information about locales and locale items.
1306 @end defun 1372 @end defun
1307 1373
1308 @ignore 1374 @ignore
1309 arch-tag: be705bf8-941b-4c35-84fc-ad7d20ddb7cb 1375 arch-tag: be705bf8-941b-4c35-84fc-ad7d20ddb7cb