diff options
| author | Kenichi Handa | 2006-01-16 12:08:35 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-01-16 12:08:35 +0000 |
| commit | 0814ca04aea186499b5cc6a1454b029b71f5a5a3 (patch) | |
| tree | 24bdabad7cb202675138ba03c04e50a7c496adfd | |
| parent | 8d39b9766e97b53f7ed29d677a46e2cb2f346acf (diff) | |
| download | emacs-0814ca04aea186499b5cc6a1454b029b71f5a5a3.tar.gz emacs-0814ca04aea186499b5cc6a1454b029b71f5a5a3.zip | |
(autoload-coding-system): Prepare for EOL variants.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/international/mule.el | 47 |
2 files changed, 41 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87a8c40d176..7759b6276a7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2006-01-16 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * international/code-pages.el: Add autoload cookies for | ||
| 4 | cp125[0345678]. | ||
| 5 | |||
| 6 | * language/european.el (cp1252): New alias for windows-1252. | ||
| 7 | |||
| 8 | * international/mule.el (autoload-coding-system): Prepare for EOL | ||
| 9 | variants. | ||
| 10 | |||
| 1 | 2006-01-15 Dan Nicolaescu <dann@ics.uci.edu> | 11 | 2006-01-15 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 12 | ||
| 3 | * term.el (term-raw-map): Add mapping for insert. | 13 | * term.el (term-raw-map): Add mapping for insert. |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index cd26cd2f73f..b0320ce98d9 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1144,7 +1144,11 @@ Return the resulting coding system." | |||
| 1144 | FROM is a form to evaluate to define the coding-system." | 1144 | FROM is a form to evaluate to define the coding-system." |
| 1145 | (put symbol 'coding-system-define-form form) | 1145 | (put symbol 'coding-system-define-form form) |
| 1146 | (setq coding-system-alist (cons (list (symbol-name symbol)) | 1146 | (setq coding-system-alist (cons (list (symbol-name symbol)) |
| 1147 | coding-system-alist))) | 1147 | coding-system-alist)) |
| 1148 | (dolist (elt '("-unix" "-dos" "-mac")) | ||
| 1149 | (let ((name (concat (symbol-name symbol) elt))) | ||
| 1150 | (put (intern name) 'coding-system-define-form form) | ||
| 1151 | (setq coding-system-alist (cons (list name) coding-system-alist))))) | ||
| 1148 | 1152 | ||
| 1149 | (defun set-buffer-file-coding-system (coding-system &optional force nomodify) | 1153 | (defun set-buffer-file-coding-system (coding-system &optional force nomodify) |
| 1150 | "Set the file coding-system of the current buffer to CODING-SYSTEM. | 1154 | "Set the file coding-system of the current buffer to CODING-SYSTEM. |
| @@ -1589,6 +1593,23 @@ and the contents of `file-coding-system-alist'." | |||
| 1589 | :type '(repeat (cons (regexp :tag "Regexp") | 1593 | :type '(repeat (cons (regexp :tag "Regexp") |
| 1590 | (symbol :tag "Coding system")))) | 1594 | (symbol :tag "Coding system")))) |
| 1591 | 1595 | ||
| 1596 | (defun auto-coding-regexp-alist-lookup (from to) | ||
| 1597 | "Lookup `auto-coding-regexp-alist' for the contents of the current buffer. | ||
| 1598 | The value is a coding system is specified for the region FROM and TO, | ||
| 1599 | or nil." | ||
| 1600 | (save-excursion | ||
| 1601 | (goto-char from) | ||
| 1602 | (let ((alist auto-coding-regexp-alist) | ||
| 1603 | coding-system) | ||
| 1604 | (while (and alist (not coding-system)) | ||
| 1605 | (let ((regexp (car (car alist)))) | ||
| 1606 | (if enable-multibyte-characters | ||
| 1607 | (setq regexp (string-to-multibyte regexp))) | ||
| 1608 | (if (re-search-forward regexp to t) | ||
| 1609 | (setq coding-system (cdr (car alist))) | ||
| 1610 | (setq alist (cdr alist))))) | ||
| 1611 | coding-system))) | ||
| 1612 | |||
| 1592 | ;; See the bottom of this file for built-in auto coding functions. | 1613 | ;; See the bottom of this file for built-in auto coding functions. |
| 1593 | (defcustom auto-coding-functions '(sgml-xml-auto-coding-function | 1614 | (defcustom auto-coding-functions '(sgml-xml-auto-coding-function |
| 1594 | sgml-html-meta-auto-coding-function) | 1615 | sgml-html-meta-auto-coding-function) |
| @@ -1648,24 +1669,15 @@ indicating by what CODING is specified. Note that the validity | |||
| 1648 | of CODING is not checked; it's callers responsibility to check | 1669 | of CODING is not checked; it's callers responsibility to check |
| 1649 | it. | 1670 | it. |
| 1650 | 1671 | ||
| 1651 | If nothing is specified, the return value is nil. | 1672 | If nothing is specified, the return value is nil." |
| 1652 | |||
| 1653 | The variable `set-auto-coding-function' (which see) is set to this | ||
| 1654 | function by default." | ||
| 1655 | (or (let ((coding-system (auto-coding-alist-lookup filename))) | 1673 | (or (let ((coding-system (auto-coding-alist-lookup filename))) |
| 1656 | (if coding-system | 1674 | (if coding-system |
| 1657 | (cons coding-system 'auto-coding-alist))) | 1675 | (cons coding-system 'auto-coding-alist))) |
| 1658 | ;; Try using `auto-coding-regexp-alist'. | 1676 | ;; Try using `auto-coding-regexp-alist'. |
| 1659 | (save-excursion | 1677 | (let ((coding-system (auto-coding-regexp-alist-lookup (point) |
| 1660 | (let ((alist auto-coding-regexp-alist) | 1678 | (+ (point) size)))) |
| 1661 | coding-system) | 1679 | (if coding-system |
| 1662 | (while (and alist (not coding-system)) | 1680 | (cons coding-system 'auto-coding-regexp-alist))) |
| 1663 | (let ((regexp (car (car alist)))) | ||
| 1664 | (when (re-search-forward regexp (+ (point) size) t) | ||
| 1665 | (setq coding-system (cdr (car alist))))) | ||
| 1666 | (setq alist (cdr alist))) | ||
| 1667 | (if coding-system | ||
| 1668 | (cons coding-system 'auto-coding-regexp-alist)))) | ||
| 1669 | (let* ((case-fold-search t) | 1681 | (let* ((case-fold-search t) |
| 1670 | (head-start (point)) | 1682 | (head-start (point)) |
| 1671 | (head-end (+ head-start (min size 1024))) | 1683 | (head-end (+ head-start (min size 1024))) |
| @@ -1758,7 +1770,10 @@ function by default." | |||
| 1758 | (defun set-auto-coding (filename size) | 1770 | (defun set-auto-coding (filename size) |
| 1759 | "Return coding system for a file FILENAME of which SIZE bytes follow point. | 1771 | "Return coding system for a file FILENAME of which SIZE bytes follow point. |
| 1760 | See `find-auto-coding' for how the coding system is found. | 1772 | See `find-auto-coding' for how the coding system is found. |
| 1761 | Return nil if an invalid coding system is found." | 1773 | Return nil if an invalid coding system is found. |
| 1774 | |||
| 1775 | The variable `set-auto-coding-function' (which see) is set to this | ||
| 1776 | function by default." | ||
| 1762 | (let ((found (find-auto-coding filename size))) | 1777 | (let ((found (find-auto-coding filename size))) |
| 1763 | (if (and found (coding-system-p (car found))) | 1778 | (if (and found (coding-system-p (car found))) |
| 1764 | (car found)))) | 1779 | (car found)))) |