emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/gnus/mm-util.el [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/mm-util.el [emacs-unicode-2]
Date: Thu, 04 Nov 2004 04:03:11 -0500

Index: emacs/lisp/gnus/mm-util.el
diff -c emacs/lisp/gnus/mm-util.el:1.27.6.6 emacs/lisp/gnus/mm-util.el:1.27.6.7
*** emacs/lisp/gnus/mm-util.el:1.27.6.6 Wed Sep 29 07:22:15 2004
--- emacs/lisp/gnus/mm-util.el  Thu Nov  4 08:55:29 2004
***************
*** 123,135 ****
  
  (defun mm-coding-system-p (cs)
    "Return non-nil if CS is a symbol naming a coding system.
! In XEmacs, also return non-nil if CS is a coding system object."
    (if (fboundp 'find-coding-system)
        (find-coding-system cs)
      (if (fboundp 'coding-system-p)
!       (coding-system-p cs)
        ;; Is this branch ever actually useful?
!       (memq cs (mm-get-coding-system-list)))))
  
  (defvar mm-charset-synonym-alist
    `(
--- 123,138 ----
  
  (defun mm-coding-system-p (cs)
    "Return non-nil if CS is a symbol naming a coding system.
! In XEmacs, also return non-nil if CS is a coding system object.
! If CS is available, return CS itself in Emacs, and return a coding
! system object in XEmacs."
    (if (fboundp 'find-coding-system)
        (find-coding-system cs)
      (if (fboundp 'coding-system-p)
!       (when (coding-system-p cs)
!         cs)
        ;; Is this branch ever actually useful?
!       (car (memq cs (mm-get-coding-system-list))))))
  
  (defvar mm-charset-synonym-alist
    `(
***************
*** 219,230 ****
      (big5 chinese-big5-1 chinese-big5-2)
      (tibetan tibetan)
      (thai-tis620 thai-tis620)
      (iso-2022-7bit ethiopic arabic-1-column arabic-2-column)
      (iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7
                   latin-jisx0201 japanese-jisx0208-1978
                   chinese-gb2312 japanese-jisx0208
!                  korean-ksc5601 japanese-jisx0212
!                  katakana-jisx0201)
      (iso-2022-int-1 latin-iso8859-1 greek-iso8859-7
                    latin-jisx0201 japanese-jisx0208-1978
                    chinese-gb2312 japanese-jisx0208
--- 222,233 ----
      (big5 chinese-big5-1 chinese-big5-2)
      (tibetan tibetan)
      (thai-tis620 thai-tis620)
+     (windows-1251 cyrillic-iso8859-5)
      (iso-2022-7bit ethiopic arabic-1-column arabic-2-column)
      (iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7
                   latin-jisx0201 japanese-jisx0208-1978
                   chinese-gb2312 japanese-jisx0208
!                  korean-ksc5601 japanese-jisx0212)
      (iso-2022-int-1 latin-iso8859-1 greek-iso8859-7
                    latin-jisx0201 japanese-jisx0208-1978
                    chinese-gb2312 japanese-jisx0208
***************
*** 239,244 ****
--- 242,250 ----
                    chinese-cns11643-3 chinese-cns11643-4
                    chinese-cns11643-5 chinese-cns11643-6
                    chinese-cns11643-7)
+     (iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208
+                  japanese-jisx0213-1 japanese-jisx0213-2)
+     (shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208)
      ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case
             (charsetp 'unicode-a)
             (not (mm-coding-system-p 'mule-utf-8)))
***************
*** 249,280 ****
                       (coding-system-get 'mule-utf-8 'safe-charsets)))))
    "Alist of MIME-charset/MULE-charsets.")
  
! ;; Correct by construction, but should be unnecessary:
! ;; XEmacs hates it.
! (when (and (not (featurep 'xemacs))
!          (fboundp 'coding-system-list)
!          (fboundp 'sort-coding-systems))
!   (setq mm-mime-mule-charset-alist
!       (apply
!        'nconc
!        (mapcar
!         (lambda (cs)
!           (when (and (or (coding-system-get cs :mime-charset) ; Emacs 22
!                          (coding-system-get cs 'mime-charset))
!                      (not (eq t (coding-system-get cs 'safe-charsets))))
!             (list (cons (or (coding-system-get cs :mime-charset)
!                             (coding-system-get cs 'mime-charset))
!                         (delq 'ascii
!                               (coding-system-get cs 'safe-charsets))))))
!         (sort-coding-systems (coding-system-list 'base-only))))))
  
  (defcustom mm-coding-system-priorities
    (if (boundp 'current-language-environment)
        (let ((lang (symbol-value 'current-language-environment)))
        (cond ((string= lang "Japanese")
!              ;; Japanese users may prefer iso-2022-jp to shift-jis.
!              '(iso-2022-jp iso-2022-jp-2 japanese-shift-jis
!                            iso-latin-1 utf-8)))))
    "Preferred coding systems for encoding outgoing messages.
  
  More than one suitable coding system may be found for some text.
--- 255,310 ----
                       (coding-system-get 'mule-utf-8 'safe-charsets)))))
    "Alist of MIME-charset/MULE-charsets.")
  
! (defun mm-enrich-utf-8-by-mule-ucs ()
!   "Make the `utf-8' MIME charset usable by the Mule-UCS package.
! This function will run when the `un-define' module is loaded under
! XEmacs, and fill the `utf-8' entry in `mm-mime-mule-charset-alist'
! with Mule charsets.  It is completely useless for Emacs."
!   (unless (cdr (delete '(mm-enrich-utf-8-by-mule-ucs)
!                      (assoc "un-define" after-load-alist)))
!     (setq after-load-alist
!         (delete '("un-define") after-load-alist)))
!   (when (boundp 'unicode-basic-translation-charset-order-list)
!     (condition-case nil
!       (let ((val (delq
!                   'ascii
!                   (copy-sequence
!                    (symbol-value
!                     'unicode-basic-translation-charset-order-list))))
!             (elem (assq 'utf-8 mm-mime-mule-charset-alist)))
!         (if elem
!             (setcdr elem val)
!           (setq mm-mime-mule-charset-alist
!                 (nconc mm-mime-mule-charset-alist
!                        (list (cons 'utf-8 val))))))
!       (error))))
! 
! ;; Correct by construction, but should be unnecessary for Emacs:
! (if (featurep 'xemacs)
!     (eval-after-load "un-define" '(mm-enrich-utf-8-by-mule-ucs))
!   (when (and (fboundp 'coding-system-list)
!            (fboundp 'sort-coding-systems))
!     (let ((css (sort-coding-systems (coding-system-list 'base-only)))
!         cs mime mule alist)
!       (while css
!       (setq cs (pop css)
!             mime (or (coding-system-get cs :mime-charset) ; Emacs 22
!                      (coding-system-get cs 'mime-charset)))
!       (when (and mime
!                  (not (eq t (setq mule
!                                   (coding-system-get cs 'safe-charsets))))
!                  (not (assq mime alist)))
!         (push (cons mime (delq 'ascii mule)) alist)))
!       (setq mm-mime-mule-charset-alist (nreverse alist)))))
  
  (defcustom mm-coding-system-priorities
    (if (boundp 'current-language-environment)
        (let ((lang (symbol-value 'current-language-environment)))
        (cond ((string= lang "Japanese")
!              ;; Japanese users prefer iso-2022-jp to euc-japan or
!              ;; shift_jis, however iso-8859-1 should be used when
!              ;; there are only ASCII text and Latin-1 characters.
!              '(iso-8859-1 iso-2022-jp iso-2022-jp-2 shift_jis utf-8)))))
    "Preferred coding systems for encoding outgoing messages.
  
  More than one suitable coding system may be found for some text.
***************
*** 301,316 ****
    "Return the MIME charset corresponding to the given Mule CHARSET."
    (if (and (fboundp 'find-coding-systems-for-charsets)
           (fboundp 'sort-coding-systems))
!       (let (mime)
!       (dolist (cs (sort-coding-systems
!                    (copy-sequence
!                     (find-coding-systems-for-charsets (list charset)))))
!         (unless mime
!           (when cs
!             (setq mime (or (coding-system-get cs :mime-charset)
!                            (coding-system-get cs 'mime-charset))))))
        mime)
!     (let ((alist mm-mime-mule-charset-alist)
          out)
        (while alist
        (when (memq charset (cdar alist))
--- 331,350 ----
    "Return the MIME charset corresponding to the given Mule CHARSET."
    (if (and (fboundp 'find-coding-systems-for-charsets)
           (fboundp 'sort-coding-systems))
!       (let ((css (sort (sort-coding-systems
!                       (find-coding-systems-for-charsets (list charset)))
!                      'mm-sort-coding-systems-predicate))
!           cs mime)
!       (while (and (not mime)
!                   css)
!         (when (setq cs (pop css))
!           (setq mime (or (coding-system-get cs :mime-charset)
!                          (coding-system-get cs 'mime-charset)))))
        mime)
!     (let ((alist (mapcar (lambda (cs)
!                          (assq cs mm-mime-mule-charset-alist))
!                        (sort (mapcar 'car mm-mime-mule-charset-alist)
!                              'mm-sort-coding-systems-predicate)))
          out)
        (while alist
        (when (memq charset (cdar alist))
***************
*** 482,492 ****
    (let ((priorities
         (mapcar (lambda (cs)
                   ;; Note: invalid entries are dropped silently
!                  (and (coding-system-p cs)
                        (coding-system-base cs)))
                 mm-coding-system-priorities)))
!     (> (length (memq a priorities))
!        (length (memq b priorities)))))
  
  (defun mm-find-mime-charset-region (b e)
    "Return the MIME charsets needed to encode the region between B and E.
--- 516,529 ----
    (let ((priorities
         (mapcar (lambda (cs)
                   ;; Note: invalid entries are dropped silently
!                  (and (setq cs (mm-coding-system-p cs))
                        (coding-system-base cs)))
                 mm-coding-system-priorities)))
!     (and (setq a (mm-coding-system-p a))
!        (if (setq b (mm-coding-system-p b))
!            (> (length (memq (coding-system-base a) priorities))
!               (length (memq (coding-system-base b) priorities)))
!          t))))
  
  (defun mm-find-mime-charset-region (b e)
    "Return the MIME charsets needed to encode the region between B and E.




reply via email to

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