comparison lisp/international/mule.el @ 71255:ea0fe02fbe1b

(find-auto-coding): Don't handle the short name `char-trans'.
author Kenichi Handa <handa@m17n.org>
date Wed, 07 Jun 2006 01:20:16 +0000
parents 4331609429da
children 6930c75732b8 46b1096093f5 a8190f7e546e
comparison
equal deleted inserted replaced
71254:db157113b47c 71255:ea0fe02fbe1b
1699 ;; Try a short cut by searching for the string "coding:" 1699 ;; Try a short cut by searching for the string "coding:"
1700 ;; and for "unibyte:" at the head and tail of SIZE bytes. 1700 ;; and for "unibyte:" at the head and tail of SIZE bytes.
1701 (setq head-found (or (search-forward "coding:" head-end t) 1701 (setq head-found (or (search-forward "coding:" head-end t)
1702 (search-forward "unibyte:" head-end t) 1702 (search-forward "unibyte:" head-end t)
1703 (search-forward "enable-character-translation:" 1703 (search-forward "enable-character-translation:"
1704 head-end t) 1704 head-end t)))
1705 (search-forward "char-trans:" head-end t)))
1706 (if (and head-found (> head-found tail-start)) 1705 (if (and head-found (> head-found tail-start))
1707 ;; Head and tail are overlapped. 1706 ;; Head and tail are overlapped.
1708 (setq tail-found head-found) 1707 (setq tail-found head-found)
1709 (goto-char tail-start) 1708 (goto-char tail-start)
1710 (setq tail-found (or (search-forward "coding:" tail-end t) 1709 (setq tail-found (or (search-forward "coding:" tail-end t)
1711 (search-forward "unibyte:" tail-end t) 1710 (search-forward "unibyte:" tail-end t)
1712 (search-forward "char-trans:" tail-end t)
1713 (search-forward "enable-character-translation:" 1711 (search-forward "enable-character-translation:"
1714 tail-end t)))) 1712 tail-end t))))
1715 1713
1716 ;; At first check the head. 1714 ;; At first check the head.
1717 (when head-found 1715 (when head-found
1729 (re-search-forward 1727 (re-search-forward
1730 "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)" 1728 "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)"
1731 head-end t)) 1729 head-end t))
1732 (setq coding-system (intern (match-string 2)))) 1730 (setq coding-system (intern (match-string 2))))
1733 (when (re-search-forward 1731 (when (re-search-forward
1734 "\\(.*;\\)?[ \t]*\\(enable-character-translation\\|char-trans\\):[ \t]*\\([^ ;]+\\)" 1732 "\\(.*;\\)?[ \t]*enable-character-translation:[ \t]*\\([^ ;]+\\)"
1735 head-end t) 1733 head-end t)
1736 (setq char-trans (match-string 3))))) 1734 (setq char-trans (match-string 2)))))
1737 1735
1738 ;; If no coding: tag in the head, check the tail. 1736 ;; If no coding: tag in the head, check the tail.
1739 ;; Here we must pay attention to the case that the end-of-line 1737 ;; Here we must pay attention to the case that the end-of-line
1740 ;; is just "\r" and we can't use "^" nor "$" in regexp. 1738 ;; is just "\r" and we can't use "^" nor "$" in regexp.
1741 (when (and tail-found (or (not coding-system) (not char-trans))) 1739 (when (and tail-found (or (not coding-system) (not char-trans)))
1762 "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" 1760 "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*"
1763 suffix "[\r\n]")) 1761 suffix "[\r\n]"))
1764 (re-char-trans 1762 (re-char-trans
1765 (concat 1763 (concat
1766 "[\r\n]" prefix 1764 "[\r\n]" prefix
1767 "[ \t]*\\(enable-character-translation\\|char-trans\\)[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" 1765 "[ \t]*enable-character-translation[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*"
1768 suffix "[\r\n]")) 1766 suffix "[\r\n]"))
1769 (re-end 1767 (re-end
1770 (concat "[\r\n]" prefix "[ \t]*End *:[ \t]*" suffix 1768 (concat "[\r\n]" prefix "[ \t]*End *:[ \t]*" suffix
1771 "[\r\n]?")) 1769 "[\r\n]?"))
1772 (pos (1- (point)))) 1770 (pos (1- (point))))
1780 (when (and (not coding-system) 1778 (when (and (not coding-system)
1781 (re-search-forward re-coding tail-end t)) 1779 (re-search-forward re-coding tail-end t))
1782 (setq coding-system (intern (match-string 1)))) 1780 (setq coding-system (intern (match-string 1))))
1783 (when (and (not char-trans) 1781 (when (and (not char-trans)
1784 (re-search-forward re-char-trans tail-end t)) 1782 (re-search-forward re-char-trans tail-end t))
1785 (setq char-trans (match-string 2)))))) 1783 (setq char-trans (match-string 1))))))
1786 (if coding-system 1784 (if coding-system
1787 ;; If the coding-system name ends with "!", remove it and 1785 ;; If the coding-system name ends with "!", remove it and
1788 ;; set char-trans to "nil". 1786 ;; set char-trans to "nil".
1789 (let ((name (symbol-name coding-system))) 1787 (let ((name (symbol-name coding-system)))
1790 (if (= (aref name (1- (length name))) ?!) 1788 (if (= (aref name (1- (length name))) ?!)