emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/international/mule.el


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/lisp/international/mule.el
Date: Mon, 18 Jul 2005 22:30:29 -0400

Index: emacs/lisp/international/mule.el
diff -c emacs/lisp/international/mule.el:1.224 
emacs/lisp/international/mule.el:1.225
*** emacs/lisp/international/mule.el:1.224      Thu Jul  7 06:21:30 2005
--- emacs/lisp/international/mule.el    Tue Jul 19 02:30:29 2005
***************
*** 1621,1628 ****
        (setq alist (cdr alist))))
      coding-system))
  
! (defun set-auto-coding (filename size)
!   "Return coding system for a file FILENAME of which SIZE bytes follow point.
  These bytes should include at least the first 1k of the file
  and the last 3k of the file, but the middle may be omitted.
  
--- 1621,1628 ----
        (setq alist (cdr alist))))
      coding-system))
  
! (defun find-auto-coding (filename size)
!   "Find a coding system for a file FILENAME of which SIZE bytes follow point.
  These bytes should include at least the first 1k of the file
  and the last 3k of the file, but the middle may be omitted.
  
***************
*** 1636,1647 ****
  succeed, it checks to see if any function in `auto-coding-functions'
  gives a match.
  
! The return value is the specified coding system, or nil if nothing is
! specified.
  
  The variable `set-auto-coding-function' (which see) is set to this
  function by default."
!   (or (auto-coding-alist-lookup filename)
        ;; Try using `auto-coding-regexp-alist'.
        (save-excursion
        (let ((alist auto-coding-regexp-alist)
--- 1636,1656 ----
  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 callers responsibility to check
! it.
! 
! If nothing is specified, the return value is nil.
  
  The variable `set-auto-coding-function' (which see) is set to this
  function by default."
!   (or (let ((coding-system (auto-coding-alist-lookup filename)))
!       (if coding-system
!           (cons coding-system 'auto-coding-alist)))
        ;; Try using `auto-coding-regexp-alist'.
        (save-excursion
        (let ((alist auto-coding-regexp-alist)
***************
*** 1651,1657 ****
              (when (re-search-forward regexp (+ (point) size) t)
                (setq coding-system (cdr (car alist)))))
            (setq alist (cdr alist)))
!         coding-system))
        (let* ((case-fold-search t)
             (head-start (point))
             (head-end (+ head-start (min size 1024)))
--- 1660,1667 ----
              (when (re-search-forward regexp (+ (point) size) t)
                (setq coding-system (cdr (car alist)))))
            (setq alist (cdr alist)))
!         (if coding-system
!             (cons coding-system 'auto-coding-regexp-alist))))
        (let* ((case-fold-search t)
             (head-start (point))
             (head-end (+ head-start (min size 1024)))
***************
*** 1685,1693 ****
                       (re-search-forward
                        "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)"
                        head-end t))
!             (setq coding-system (intern (match-string 2)))
!             (or (coding-system-p coding-system)
!                 (setq coding-system nil)))))
  
        ;; If no coding: tag in the head, check the tail.
        ;; Here we must pay attention to the case that the end-of-line
--- 1695,1701 ----
                       (re-search-forward
                        "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)"
                        head-end t))
!             (setq coding-system (intern (match-string 2))))))
  
        ;; If no coding: tag in the head, check the tail.
        ;; Here we must pay attention to the case that the end-of-line
***************
*** 1728,1737 ****
                  (setq coding-system 'raw-text))
                (when (and (not coding-system)
                           (re-search-forward re-coding tail-end t))
!                 (setq coding-system (intern (match-string 1)))
!                 (or (coding-system-p coding-system)
!                     (setq coding-system nil))))))
!       coding-system)
        ;; Finally, try all the `auto-coding-functions'.
        (let ((funcs auto-coding-functions)
            (coding-system nil))
--- 1736,1744 ----
                  (setq coding-system 'raw-text))
                (when (and (not coding-system)
                           (re-search-forward re-coding tail-end t))
!                 (setq coding-system (intern (match-string 1)))))))
!       (if coding-system
!           (cons coding-system :coding)))
        ;; Finally, try all the `auto-coding-functions'.
        (let ((funcs auto-coding-functions)
            (coding-system nil))
***************
*** 1741,1747 ****
                                    (goto-char (point-min))
                                    (funcall (pop funcs) size))
                                (error nil))))
!       coding-system)))
  
  (setq set-auto-coding-function 'set-auto-coding)
  
--- 1748,1763 ----
                                    (goto-char (point-min))
                                    (funcall (pop funcs) size))
                                (error nil))))
!       (if coding-system
!           (cons coding-system 'auto-coding-functions)))))
! 
! (defun set-auto-coding (filename size)
!   "Return coding system for a file FILENAME of which SIZE bytes follow point.
! See `find-auto-coding' for how the coding system is found.
! Return nil if an invalid coding system is found."
!   (let ((found (find-auto-coding filename size)))
!     (if (and found (coding-system-p (car found)))
!       (car found))))
  
  (setq set-auto-coding-function 'set-auto-coding)
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]