Show
Ignore:
Timestamp:
2006年07月29日 07時48分34秒 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/international/mule-cmds.el

    r4111 r4131  
    832832list of coding systems to be prepended to the default coding system 
    833833list.  However, if DEFAULT-CODING-SYSTEM is a list and the first 
    834 element is t, the cdr part is used as the defualt coding system list, 
     834element is t, the cdr part is used as the default coding system list, 
    835835i.e. `buffer-file-coding-system', `default-buffer-file-coding-system', 
    836836and the most preferred coding system are not used. 
     
    899899              (push (cons auto-cs base) default-coding-system)))) 
    900900 
    901     ;; From now on, the list of defaults is reversed. 
    902     (setq default-coding-system (nreverse default-coding-system)) 
    903  
    904901    (unless no-other-defaults 
    905902      ;; If buffer-file-coding-system is not nil nor undecided, append it 
     
    909906            (or (eq base 'undecided) 
    910907                (rassq base default-coding-system) 
    911                 (push (cons buffer-file-coding-system base) 
    912                       default-coding-system)))) 
     908                (setq default-coding-system 
     909                      (append default-coding-system 
     910                              (list (cons buffer-file-coding-system base))))))) 
    913911 
    914912      ;; If default-buffer-file-coding-system is not nil nor undecided, 
     
    918916            (or (eq base 'undecided) 
    919917                (rassq base default-coding-system) 
    920                 (push (cons default-buffer-file-coding-system base) 
    921                       default-coding-system)))) 
     918                (setq default-coding-system 
     919                      (append default-coding-system 
     920                              (list (cons default-buffer-file-coding-system  
     921                                          base))))))) 
    922922 
    923923      ;; If the most preferred coding system has the property mime-charset, 
     
    931931             (coding-system-get preferred 'mime-charset) 
    932932             (not (rassq base default-coding-system)) 
    933              (push (cons preferred base) 
    934                    default-coding-system)))) 
     933             (setq default-coding-system 
     934                   (append default-coding-system 
     935                           (list (cons preferred base))))))) 
    935936 
    936937    (if select-safe-coding-system-accept-default-p 
    937938        (setq accept-default-p select-safe-coding-system-accept-default-p)) 
     939 
     940    ;; Decide the eol-type from the top of the default codings, 
     941    ;; buffer-file-coding-system, or 
     942    ;; default-buffer-file-coding-system. 
     943    (if default-coding-system 
     944        (let ((default-eol-type (coding-system-eol-type 
     945                                 (caar default-coding-system)))) 
     946          (if (and (vectorp default-eol-type) buffer-file-coding-system) 
     947              (setq default-eol-type (coding-system-eol-type  
     948                                      buffer-file-coding-system))) 
     949          (if (and (vectorp default-eol-type) default-buffer-file-coding-system) 
     950              (setq default-eol-type (coding-system-eol-type  
     951                                      default-buffer-file-coding-system))) 
     952          (if (and default-eol-type (not (vectorp default-eol-type))) 
     953              (dolist (elt default-coding-system) 
     954                (setcar elt (coding-system-change-eol-conversion 
     955                             (car elt) default-eol-type)))))) 
    938956 
    939957    (let ((codings (find-coding-systems-region from to)) 
     
    942960      (if (eq (car codings) 'undecided) 
    943961          ;; Any coding system is ok. 
    944           (setq coding-system t) 
     962          (setq coding-system (caar default-coding-system)) 
     963        ;; Reverse the list so that elements are accumulated in safe, 
     964        ;; rejected, and unsafe in the correct order. 
     965        (setq default-coding-system (nreverse default-coding-system)) 
     966 
    945967        ;; Classify the defaults into safe, rejected, and unsafe. 
    946968        (dolist (elt default-coding-system) 
     
    959981                             from to codings unsafe rejected (car codings)))) 
    960982 
    961       (if (vectorp (coding-system-eol-type coding-system)) 
    962           (let ((eol (coding-system-eol-type buffer-file-coding-system))) 
    963             (if (numberp eol) 
    964                 (setq coding-system 
    965                       (coding-system-change-eol-conversion coding-system eol))))) 
    966  
    967       (if (eq coding-system t) 
    968           (setq coding-system buffer-file-coding-system)) 
    969983      ;; Check we're not inconsistent with what `coding:' spec &c would 
    970984      ;; give when file is re-read.