;;; mule.el --- basic commands for multilingual environment
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008
+;; 2005, 2006, 2007, 2008, 2009
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Copyright (C) 2003
(defvar emacs-mule-charset-table (make-vector 256 nil))
(aset emacs-mule-charset-table 0 'ascii)
-;; Convert the argument of old-style calll of define-charset to a
+;; Convert the argument of old-style call of define-charset to a
;; property list used by the new-style.
;; INFO-VECTOR is a vector of the format:
;; [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE
(defun charset-id (charset)
"Always return 0. This is provided for backward compatibility."
0)
+(make-obsolete 'charset-id "do not use it." "23.1")
(defmacro charset-bytes (charset)
"Always return 0. This is provided for backward compatibility."
0)
+(make-obsolete 'charset-bytes "do not use it." "23.1")
(defun get-charset-property (charset propname)
"Return the value of CHARSET's PROPNAME property.
(plist-get (charset-plist charset) :long-name))
(defun charset-list ()
- "Return list of all charsets ever defined.
-
-This function is provided for backward compatibility.
-Now we have the variable `charset-list'."
+ "Return list of all charsets ever defined."
charset-list)
(make-obsolete 'charset-list "use variable `charset-list'." "23.1")
\f
;;; CHARACTER
-(defalias 'char-valid-p 'characterp)
-(make-obsolete 'char-valid-p 'characterp "23.1")
+(define-obsolete-function-alias 'char-valid-p 'characterp "23.1")
(defun generic-char-p (char)
"Always return nil. This is provided for backward compatibility."
may be any symbol.
The following attributes have special meanings. Those labeled as
-\"(required)\", should not be omitted.
+\"(required)\" should not be omitted.
`:mnemonic' (required)
VALUE is the EOL (end-of-line) format of the coding system. It must be
one of `unix', `dos', `mac'. The symbol `unix' means Unix-like EOL
\(i.e. single LF), `dos' means DOS-like EOL \(i.e. sequence of CR LF),
-and `mac' means MAC-like EOL \(i.e. single CR). If omitted, on
+and `mac' means Mac-like EOL \(i.e. single CR). If omitted, on
decoding by the coding system, Emacs automatically detects the EOL
format of the source text.
`:eol-type'
VALUE must be `unix', `dos', `mac'. The symbol `unix' means Unix-like
-EOL (LF), `dos' means DOS-like EOL (CRLF), and `mac' means MAC-like
+EOL (LF), `dos' means DOS-like EOL (CRLF), and `mac' means Mac-like
EOL (CR). If omitted, on decoding, the coding system detects EOL
format automatically, and on encoding, uses Unix-like EOL.
`:bom'
This attributes specifies whether the coding system uses a `byte order
-mark'. VALUE must nil, t, or cons of coding systems whose
-`:coding-type' is `utf-16'.
+mark'. VALUE must be nil, t, or cons of coding systems whose
+`:coding-type' is `utf-16' or `utf-8'.
If the value is nil, on decoding, don't treat the first two-byte as
BOM, and on encoding, don't produce BOM bytes.
If the value is t, on decoding, skip the first two-byte as BOM, and on
encoding, produce BOM bytes accoding to the value of `:endian'.
-If the value is cons, on decoding, check the first two-byte. If theyq
+If the value is cons, on decoding, check the first two-byte. If they
are 0xFE 0xFF, use the car part coding system of the value. If they
-are 0xFF 0xFE, use the car part coding system of the value.
+are 0xFF 0xFE, use the cdr part coding system of the value.
Otherwise, treat them as bytes for a normal character. On encoding,
produce BOM bytes accoding to the value of `:endian'.
-This attribute has a meaning only when `:coding-type' is `utf-16'.
+This attribute has a meaning only when `:coding-type' is `utf-16' or
+`utf-8'.
`:endian'
(defun coding-system-equal (coding-system-1 coding-system-2)
"Return t if and only if CODING-SYSTEM-1 and CODING-SYSTEM-2 are identical.
-Two coding systems are identical if two symbols are equal
+Two coding systems are identical if both symbols are equal
or one is an alias of the other."
(or (eq coding-system-1 coding-system-2)
(and (equal (coding-system-plist coding-system-1)
properties
eol-type)
"Define a new coding system CODING-SYSTEM (symbol).
-This function is provided for backward compatibility.
-Use `define-coding-system' instead."
+This function is provided for backward compatibility."
;; For compatiblity with XEmacs, we check the type of TYPE. If it
;; is a symbol, perhaps, this function is called with XEmacs-style
;; arguments. Here, try to transform that kind of arguments to
(apply 'define-coding-system coding-system doc-string properties))
+(make-obsolete 'make-coding-system 'define-coding-system "23.1")
+
(defun merge-coding-systems (first second)
"Fill in any unspecified aspects of coding system FIRST from SECOND.
Return the resulting coding system."
(defun autoload-coding-system (symbol form)
"Define SYMBOL as a coding-system that is defined on demand.
-FROM is a form to evaluate to define the coding-system."
+FORM is a form to evaluate to define the coding-system."
(put symbol 'coding-system-define-form form)
(setq coding-system-alist (cons (list (symbol-name symbol))
coding-system-alist))
(defun set-buffer-file-coding-system (coding-system &optional force nomodify)
"Set the file coding-system of the current buffer to CODING-SYSTEM.
This means that when you save the buffer, it will be converted
-according to CODING-SYSTEM. For a list of possible values of CODING-SYSTEM,
-use \\[list-coding-systems].
+according to CODING-SYSTEM. For a list of possible values of
+CODING-SYSTEM, use \\[list-coding-systems].
-If CODING-SYSTEM leaves the text conversion unspecified, or if it
-leaves the end-of-line conversion unspecified, FORCE controls what to
-do. If FORCE is nil, get the unspecified aspect (or aspects) from the
-buffer's previous `buffer-file-coding-system' value (if it is
-specified there). Otherwise, leave it unspecified.
+If CODING-SYSTEM leaves the text conversion unspecified, or if it leaves
+the end-of-line conversion unspecified, FORCE controls what to do.
+If FORCE is nil, get the unspecified aspect (or aspects) from the buffer's
+previous `buffer-file-coding-system' value (if it is specified there).
+Otherwise, leave it unspecified.
This marks the buffer modified so that the succeeding \\[save-buffer]
surely saves the buffer with CODING-SYSTEM. From a program, if you
"Visit the current buffer's file again using coding system CODING-SYSTEM.
For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
-If CODING-SYSTEM leaves the text conversion unspecified, or if it
-leaves the end-of-line conversion unspecified, FORCE controls what to
-do. If FORCE is nil, get the unspecified aspect (or aspects) from the
-buffer's previous `buffer-file-coding-system' value (if it is
-specified there). Otherwise, determine it from the file contents as
-usual for visiting a file."
+If CODING-SYSTEM leaves the text conversion unspecified, or if it leaves
+the end-of-line conversion unspecified, FORCE controls what to do.
+If FORCE is nil, get the unspecified aspect (or aspects) from the buffer's
+previous `buffer-file-coding-system' value (if it is specified there).
+Otherwise, determine it from the file contents as usual for visiting a file."
(interactive "zCoding system for visited file (default nil): \nP")
(check-coding-system coding-system)
(if (and coding-system buffer-file-coding-system (null force))
(defun set-file-name-coding-system (coding-system)
"Set coding system for decoding and encoding file names to CODING-SYSTEM.
-It actually just set the variable `file-name-coding-system' (which
-see) to CODING-SYSTEM."
+It actually just set the variable `file-name-coding-system' (which see)
+to CODING-SYSTEM."
(interactive "zCoding system for file names (default nil): ")
(check-coding-system coding-system)
(if (and coding-system
DECODING is the coding system to be used to decode input from the process,
ENCODING is the coding system to be used to encode output to the process.
-For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]."
+For a list of possible coding systems, use \\[list-coding-systems]."
(interactive
"zCoding-system for output from the process: \nzCoding-system for input to the process: ")
(let ((proc (get-buffer-process (current-buffer))))
"Set priority of coding categories according to ARG.
ARG is a list of coding categories ordered by priority.
-This function is provided for backward compatibility.
-Now we have more convenient function `set-coding-system-priority'."
+This function is provided for backward compatibility."
(apply 'set-coding-system-priority
(mapcar #'(lambda (x) (symbol-value x)) arg)))
(make-obsolete 'set-coding-priority 'set-coding-system-priority "23.1")
Each element has the form (ENCODING-NAME CODING-SYSTEM N-OCTET CHARSET).
-ENCODING-NAME is an encoding name of an \"extended segments\".
+ENCODING-NAME is an encoding name of an \"extended segment\".
CODING-SYSTEM is the coding-system to encode (or decode) the
characters into (or from) the extended segment.
in the segment. It can be 0 (meaning the number of octets per
character is variable), 1, 2, 3, or 4.
-CHARSET is a charater set containing characters that are encoded
+CHARSET is a character set containing characters that are encoded
in the segment. It can be a list of character sets.
On decoding CTEXT, all encoding names listed here are recognized.
"Encode characters between FROM and TO as Compound Text w/Extended Segments.
If FROM is a string, or if the current buffer is not the one set up for us
-by `encode-coding-string', generate a new temp buffer, insert the
-text, and convert it in the temporary buffer. Otherwise, convert in-place."
+by `encode-coding-string', generate a new temp buffer, insert the text,
+and convert it in the temporary buffer. Otherwise, convert in-place."
(save-match-data
;; Setup a working buffer if necessary.
(when (stringp from)
'(("^BABYL OPTIONS:[ \t]*-\\*-[ \t]*rmail[ \t]*-\\*-" . no-conversion)
("\\`\xFE\xFF" . utf-16be-with-signature)
("\\`\xFF\xFE" . utf-16le-with-signature)
- ("\\`\xEF\xBB\xBF" . utf-8)
+ ("\\`\xEF\xBB\xBF" . utf-8-with-signature)
("\\`;ELC\024\0\0\0" . emacs-mule)) ; Emacs 20-compiled
"Alist of patterns vs corresponding coding systems.
Each element looks like (REGEXP . CODING-SYSTEM).
Each function in this list should be written to operate on the
current buffer, but should not modify it in any way. The buffer
will contain undecoded text of parts of the file. Each function
-should take one argument, SIZE, which says how many
-characters (starting from point) it should look at.
+should take one argument, SIZE, which says how many characters
+\(starting from point) it should look at.
If one of these functions succeeds in determining a coding
system, it should return that coding system. Otherwise, it
(defun auto-coding-alist-lookup (filename)
"Return the coding system specified by `auto-coding-alist' for FILENAME."
(let ((alist auto-coding-alist)
- (case-fold-search (memq system-type '(vax-vms windows-nt ms-dos cygwin)))
+ (case-fold-search (memq system-type '(windows-nt ms-dos cygwin)))
coding-system)
(while (and alist (not coding-system))
(if (string-match (car (car alist)) filename)
succeed, it checks to see if any function in `auto-coding-functions'
gives a match.
-If a coding system is specifed, the return value is a
-cons (CODING . SOURCE), where CODING is the specified coding
-system and SOURCE is a symbol `auto-coding-alist',
-`auto-coding-regexp-alist', `coding:', or `auto-coding-functions'
-indicating by what CODING is specified. Note that the validity
-of CODING is not checked; it's the caller's responsibility to check it.
+If a coding system is specifed, the return value is a cons
+\(CODING . SOURCE), where CODING is the specified coding system and
+SOURCE is a symbol `auto-coding-alist', `auto-coding-regexp-alist',
+`:coding', or `auto-coding-functions' indicating by what CODING is
+specified. Note that the validity of CODING is not checked;
+it's the caller's responsibility to check it.
If nothing is specified, the return value is nil."
(or (let ((coding-system (auto-coding-alist-lookup filename)))
to connect to if TARGET-TYPE is `network'.
CODING-SYSTEM is a coding system to perform code conversion on the I/O
-operation, or a cons cell (DECODING . ENCODING) specifying the coding systems
-for decoding and encoding respectively,
-or a function symbol which, when called, returns such a cons cell."
+operation, or a cons cell (DECODING . ENCODING) specifying the coding
+systems for decoding and encoding respectively, or a function symbol
+which, when called, returns such a cons cell."
(or (memq target-type '(file process network))
(error "Invalid target type: %s" target-type))
(or (stringp regexp)
(save-restriction
(narrow-to-region start end)
(encode-coding-region (point-min) (point-max) coding)
- (decode-coding-region (point-min) (point-max) new-coding)))
+ (decode-coding-region (point-min) (point-max) new-coding))
+ (if (region-active-p)
+ (deactivate-mark)))
(defun make-translation-table (&rest args)
"Make a translation table from arguments.
(put 'with-category-table 'lisp-indent-function 1)
(defmacro with-category-table (table &rest body)
- "Execute BODY like `progn' with CATEGORY-TABLE the current category table.
+ "Execute BODY like `progn' with TABLE the current category table.
The category table of the current buffer is saved, BODY is evaluated,
then the saved table is restored, even in case of an abnormal exit.
Value is what BODY returns."