comparison lisp/gnus/mm-util.el @ 83284:360860a0006f

Merged from miles@gnu.org--gnu-2005 (patch 45-55, 214-231) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-214 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-215 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-216 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-217 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-218 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-219 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-220 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-221 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-222 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-223 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-224 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-225 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-226 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-227 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-228 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-229 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-230 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-231 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-45 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-46 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-47 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-48 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-49 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-50 Update from CVS: texi Makefile.in CVS keyw cruft * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-51 Update from CVS: ChangeLog tweaks * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-52 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-53 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-54 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-55 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-324
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 04 Apr 2005 16:43:15 +0000
parents c0aa521e0ca7
children ad05d91d3598 4da4a09e8b1b
comparison
equal deleted inserted replaced
83283:45e5f0224d81 83284:360860a0006f
82 (if dir-flag 82 (if dir-flag
83 (make-directory file)) 83 (make-directory file))
84 file))) 84 file)))
85 (insert-byte . insert-char) 85 (insert-byte . insert-char)
86 (multibyte-char-to-unibyte . identity)))) 86 (multibyte-char-to-unibyte . identity))))
87
88 (eval-and-compile
89 (cond
90 ((fboundp 'replace-in-string)
91 (defalias 'mm-replace-in-string 'replace-in-string))
92 ((fboundp 'replace-regexp-in-string)
93 (defun mm-replace-in-string (string regexp newtext &optional literal)
94 "Replace all matches for REGEXP with NEWTEXT in STRING.
95 If LITERAL is non-nil, insert NEWTEXT literally. Return a new
96 string containing the replacements.
97
98 This is a compatibility function for different Emacsen."
99 (replace-regexp-in-string regexp newtext string nil literal)))
100 (t
101 (defun mm-replace-in-string (string regexp newtext &optional literal)
102 "Replace all matches for REGEXP with NEWTEXT in STRING.
103 If LITERAL is non-nil, insert NEWTEXT literally. Return a new
104 string containing the replacements.
105
106 This is a compatibility function for different Emacsen."
107 (let ((start 0) tail)
108 (while (string-match regexp string start)
109 (setq tail (- (length string) (match-end 0)))
110 (setq string (replace-match newtext nil literal string))
111 (setq start (- (length string) tail))))
112 string))))
87 113
88 (eval-and-compile 114 (eval-and-compile
89 (defalias 'mm-char-or-char-int-p 115 (defalias 'mm-char-or-char-int-p
90 (cond 116 (cond
91 ((fboundp 'char-or-char-int-p) 'char-or-char-int-p) 117 ((fboundp 'char-or-char-int-p) 'char-or-char-int-p)
604 But this is very much a corner case, so don't worry about it." 630 But this is very much a corner case, so don't worry about it."
605 (let ((systems mm-coding-system-priorities) csets psets curset) 631 (let ((systems mm-coding-system-priorities) csets psets curset)
606 632
607 ;; Load the Latin Unity library, if available. 633 ;; Load the Latin Unity library, if available.
608 (when (and (not (featurep 'latin-unity)) (locate-library "latin-unity")) 634 (when (and (not (featurep 'latin-unity)) (locate-library "latin-unity"))
609 (require 'latin-unity)) 635 (ignore-errors (require 'latin-unity)))
610 636
611 ;; Now, can we use it? 637 ;; Now, can we use it?
612 (if (featurep 'latin-unity) 638 (if (featurep 'latin-unity)
613 (progn 639 (progn
614 (setq csets (latin-unity-representations-feasible-region begin end) 640 (setq csets (latin-unity-representations-feasible-region begin end)
649 ;; take its default action, which equally applies to GNU Emacs. 675 ;; take its default action, which equally applies to GNU Emacs.
650 nil))) 676 nil)))
651 677
652 (defmacro mm-xemacs-find-mime-charset (begin end) 678 (defmacro mm-xemacs-find-mime-charset (begin end)
653 (when (featurep 'xemacs) 679 (when (featurep 'xemacs)
654 `(mm-xemacs-find-mime-charset-1 ,begin ,end))) 680 `(and (featurep 'mule) (mm-xemacs-find-mime-charset-1 ,begin ,end))))
655 681
656 (defun mm-find-mime-charset-region (b e &optional hack-charsets) 682 (defun mm-find-mime-charset-region (b e &optional hack-charsets)
657 "Return the MIME charsets needed to encode the region between B and E. 683 "Return the MIME charsets needed to encode the region between B and E.
658 nil means ASCII, a single-element list represents an appropriate MIME 684 nil means ASCII, a single-element list represents an appropriate MIME
659 charset, and a longer list means no appropriate charset." 685 charset, and a longer list means no appropriate charset."