aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2006-01-16 12:08:35 +0000
committerKenichi Handa2006-01-16 12:08:35 +0000
commit0814ca04aea186499b5cc6a1454b029b71f5a5a3 (patch)
tree24bdabad7cb202675138ba03c04e50a7c496adfd
parent8d39b9766e97b53f7ed29d677a46e2cb2f346acf (diff)
downloademacs-0814ca04aea186499b5cc6a1454b029b71f5a5a3.tar.gz
emacs-0814ca04aea186499b5cc6a1454b029b71f5a5a3.zip
(autoload-coding-system): Prepare for EOL variants.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/international/mule.el47
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 @@
12006-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
12006-01-15 Dan Nicolaescu <dann@ics.uci.edu> 112006-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."
1144FROM is a form to evaluate to define the coding-system." 1144FROM 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.
1598The value is a coding system is specified for the region FROM and TO,
1599or 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
1648of CODING is not checked; it's callers responsibility to check 1669of CODING is not checked; it's callers responsibility to check
1649it. 1670it.
1650 1671
1651If nothing is specified, the return value is nil. 1672If nothing is specified, the return value is nil."
1652
1653The variable `set-auto-coding-function' (which see) is set to this
1654function 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.
1760See `find-auto-coding' for how the coding system is found. 1772See `find-auto-coding' for how the coding system is found.
1761Return nil if an invalid coding system is found." 1773Return nil if an invalid coding system is found.
1774
1775The variable `set-auto-coding-function' (which see) is set to this
1776function 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))))