;ELC   
;;; Compiled by amu@quiche-lorraine.mit.edu on Thu Jan  6 19:18:01 2000
;;; from file /afs/sipb.mit.edu/contrib/emacs/packages/gnus-5.8.3/lisp/mm-util.el
;;; in Emacs version 20.4.1
;;; with bytecomp version 2.56
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`mm-util.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(require 'mail-prsvr)
#@38 Alist of MIME-charset/MULE-charsets.
(defvar mm-mime-mule-charset-alist '((us-ascii ascii) (iso-8859-1 latin-iso8859-1) (iso-8859-2 latin-iso8859-2) (iso-8859-3 latin-iso8859-3) (iso-8859-4 latin-iso8859-4) (iso-8859-5 cyrillic-iso8859-5) (koi8-r cyrillic-iso8859-5) (iso-8859-6 arabic-iso8859-6) (iso-8859-7 greek-iso8859-7) (iso-8859-8 hebrew-iso8859-8) (iso-8859-9 latin-iso8859-9) (viscii vietnamese-viscii-lower) (iso-2022-jp latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978) (euc-kr korean-ksc5601) (cn-gb-2312 chinese-gb2312) (cn-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 korean-ksc5601 japanese-jisx0212 chinese-cns11643-1 chinese-cns11643-2) (iso-2022-int-1 latin-iso8859-1 latin-iso8859-2 cyrillic-iso8859-5 greek-iso8859-7 latin-jisx0201 japanese-jisx0208-1978 chinese-gb2312 japanese-jisx0208 korean-ksc5601 japanese-jisx0212 chinese-cns11643-1 chinese-cns11643-2 chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7)) (#$ . 663))
(byte-code "\302\303\304\"\210\305\300!\204 \306\300	B\306\207" [mm-coding-system-list current-load-list mapcar #[(elem) "\302\303\304@\"!\305@!\203 \306	@\"\202 \306	A\")\207" [elem nfunc intern format "mm-%s" fboundp defalias] 4] ((decode-coding-string lambda (s a) s) (encode-coding-string lambda (s a) s) (encode-coding-region . ignore) (coding-system-list . ignore) (decode-coding-region . ignore) (char-int . identity) (device-type . ignore) (coding-system-equal . equal) (annotationp . ignore) (set-buffer-file-coding-system . ignore) (make-char lambda (charset int) (int-to-char int)) (read-coding-system lambda (prompt) "Prompt the user for a coding system." (completing-read prompt (mapcar (lambda (s) (list (symbol-name (car s)))) mm-mime-mule-charset-alist)))) boundp nil] 3)
#@29 Get the coding system list.
(defalias 'mm-get-coding-system-list #[nil "\206 \300 \211\207" [mm-coding-system-list] 2 (#$ . 2843)])
#@65 A mapping from invalid charset names to the real charset names.
(defvar mm-charset-synonym-alist '((big5 . cn-big5) (gb2312 . cn-gb-2312) (x-ctext . ctext)) (#$ . 2984))
#@43 Return non-nil if SYM is a coding system.
(defalias 'mm-coding-system-p #[(sym) "\301\302!\203\f \302!\206 \303 >\207" [sym fboundp coding-system-p mm-get-coding-system-list] 2 (#$ . 3160)])
#@28 100% binary coding system.
(defvar mm-binary-coding-system (byte-code "\300\301!\203 \301\207\300\302!\203 \302\207\303\207" [mm-coding-system-p binary no-conversion nil] 2) (#$ . 3360))
#@44 Text-safe coding system (For removing ^M).
(defvar mm-text-coding-system (byte-code "\302>\203 \303\304!\203 \304\207\303\305!\203 \305\207	\207" [system-type mm-binary-coding-system (windows-nt ms-dos ms-windows) mm-coding-system-p raw-text-dos raw-text] 2) (#$ . 3555))
#@31 Text coding system for write.
(defvar mm-text-coding-system-for-write nil (#$ . 3837))
#@34 Coding system of auto save file.
(defvar mm-auto-save-coding-system (byte-code "\302\303!\203 \304>\203 \302\305!\203 \305\207	\207\303\207\302\306!\203  \306\207	\207" [system-type mm-binary-coding-system mm-coding-system-p emacs-mule (windows-nt ms-dos ms-windows) emacs-mule-dos escape-quoted] 2) (#$ . 3930))
#@56 Return the MIME charset corresponding to MULE CHARSET.
(defalias 'mm-mule-charset-to-mime-charset #[(charset) "\304\n\203 \n@A>\203 \n@@\304\n\211A\210\202 	*\207" [mm-mime-mule-charset-alist out alist charset nil] 2 (#$ . 4253)])
#@216 Return coding-system corresponding to CHARSET.
CHARSET is a symbol naming a MIME charset.
If optional argument LBT (`unix', `dos' or `mac') is specified, it is
used as the line break code type of the coding system.
(defalias 'mm-charset-to-coding-system #[(charset &optional lbt) ";\203\n \303\227!	\236A\206 \n\203 \303\304\305\n#!\306 \204& \207\307=\203. \310\207\306 >\2037 \207\311\207" [charset mm-charset-synonym-alist lbt intern format "%s-%s" mm-get-coding-system-list us-ascii ascii nil] 5 (#$ . 4501)])
#@47 Replace characters in STRING from FROM to TO.
(defalias 'mm-replace-chars-in-string #[(string from to) "\305\306OG\305	\nW\203$ 	HU\203 	\fI\210	T\211\202 +\207" [string idx len from to 0 nil] 4 (#$ . 5035)])
#@41 Enable multibyte in the current buffer.
(defalias 'mm-enable-multibyte #[nil "\300\301!\205 \302\303!\205 \304\303!\205 \301\305!\207" [fboundp set-buffer-multibyte boundp enable-multibyte-characters default-value t] 2 (#$ . 5262)])
(put 'mm-enable-multibyte 'byte-optimizer 'byte-compile-inline-expand)
#@42 Disable multibyte in the current buffer.
(defalias 'mm-disable-multibyte #[nil "\300\301!\205	 \301\302!\207" [fboundp set-buffer-multibyte nil] 2 (#$ . 5575)])
(put 'mm-disable-multibyte 'byte-optimizer 'byte-compile-inline-expand)
(defalias 'mm-preferred-coding-system #[(charset) "\301\302\"\206 \301\303\"\207" [charset get-charset-property prefered-coding-system preferred-coding-system] 3])
#@212 Return charset of a character in current buffer at position POS.
If POS is nil, it defauls to the current point.
If POS is out of range, the value is nil.
If the charset is `composition', return the actual one.
(defalias 'mm-charset-after #[(&optional pos) "\306\307!\203\f \307!\202V \306\310!\203 \310f!\202V \311f!\312W\203& \313\202V 	\203. 	\202V \314\302!\203I \315\n\"\316\317\f\236!@\206C \320\211)\202V \316\236!@\206T \320\211\211\321=\203q \206c `\322\211T\"A@)\202s )\207" [pos mail-parse-mule-charset current-language-environment language-info-alist entry mail-parse-charset fboundp charset-after char-charset mm-char-int 128 ascii boundp assoc last charset latin-iso8859-1 composition find-charset-region mm-mime-mule-charset-alist p] 4 (#$ . 5982)])
#@60 Return the MIME charset corresponding to the MULE CHARSET.
(defalias 'mm-mime-charset #[(charset) "\301\302!\203' \303!\203 \302\303!\304\"\206* \305=\203 \306\207\303!\206* \307!\207\307!\207" [charset fboundp coding-system-get mm-preferred-coding-system mime-charset ascii us-ascii mm-mule-charset-to-mime-charset] 3 (#$ . 6773)])
#@70 Simple  substitute for CL `delete-duplicates', testing with `equal'.
(defalias 'mm-delete-duplicates #[(list) "\303\211\n\203 \n@\304\n\"	B\202 	\237*\207" [head result list nil delete] 3 (#$ . 7120)])
#@71 Return the MIME charsets needed to encode the region between B and E.
(defalias 'mm-find-mime-charset-region #[(b e) "\303\304\305\306\307	\"\"\"\310\n>\203 \305\311\n\"\312\n!\211G\313V\2034 \314\315!\2034 \316\315	\">\2034 \317\2025 \n)\207" [b e charsets mapcar mm-mime-charset delq ascii mm-find-charset-region iso-2022-jp-2 iso-2022-jp mm-delete-duplicates 1 fboundp find-coding-systems-region utf-8 (utf-8)] 8 (#$ . 7337)])
#@35 Say whether multibyte is enabled.
(defalias 'mm-multibyte-p #[nil "\302\303\"\206 \304\301!\205 	\207" [emacs-version enable-multibyte-characters string-match "XEmacs\\|Lucid" boundp] 3 (#$ . 7779)])
(put 'mm-multibyte-p 'byte-optimizer 'byte-compile-inline-expand)
#@122 Create a temporary buffer, and evaluate FORMS there like `progn'.
See also `with-temp-file' and `with-output-to-string'.
(defalias 'mm-with-unibyte-buffer '(macro . #[(&rest forms) "\303\304!\303\305!\306\307\310\nB\311\312B	D\313\314\315\316	\317BB\313\320	\311\321\nBBE\322\323	D\324	DEEF\325\326EEEF*\207" [multibyte temp-buffer forms make-symbol "temp-buffer" "multibyte" if (or (string-match "XEmacs\\|Lucid" emacs-version) (not (boundp 'enable-multibyte-characters))) with-temp-buffer let ((default-value 'enable-multibyte-characters)) unwind-protect progn (setq-default enable-multibyte-characters nil) setq ((get-buffer-create (generate-new-buffer-name " *temp*"))) with-current-buffer ((buffer-file-coding-system mm-binary-coding-system) (coding-system-for-read mm-binary-coding-system) (coding-system-for-write mm-binary-coding-system)) and buffer-name kill-buffer setq-default enable-multibyte-characters] 15 (#$ . 8055)]))
(byte-code "\300\301\302\303#\210\300\301\304\305#\207" [put mm-with-unibyte-buffer lisp-indent-function 0 edebug-form-spec (body)] 4)
#@54 Evaluate FORMS there like `progn' in current buffer.
(defalias 'mm-with-unibyte-current-buffer '(macro . #[(&rest forms) "\302\303!\304\305\306	B\307\310BC\311\307\312\313	BBB\314DEEF)\207" [multibyte forms make-symbol "multibyte" if (or (string-match "XEmacs\\|Lucid" emacs-version) (not (fboundp 'set-buffer-multibyte))) progn let ((default-value 'enable-multibyte-characters)) unwind-protect ((buffer-file-coding-system mm-binary-coding-system) (coding-system-for-read mm-binary-coding-system) (coding-system-for-write mm-binary-coding-system)) (set-buffer-multibyte nil) set-buffer-multibyte] 10 (#$ . 9135)]))
(byte-code "\300\301\302\303#\210\300\301\304\305#\207" [put mm-with-unibyte-current-buffer lisp-indent-function 0 edebug-form-spec (body)] 4)
#@69 Set default `enable-multibyte-characters' to `nil', eval the FORMS.
(defalias 'mm-with-unibyte '(macro . #[(&rest forms) "\302\303!\304\305\306	B\307\310BC\311\306\312	BB\313\314EEEF)\207" [multibyte forms make-symbol "multibyte" if (or (string-match "XEmacs\\|Lucid" emacs-version) (not (boundp 'enable-multibyte-characters))) progn let ((default-value 'enable-multibyte-characters)) unwind-protect (setq-default enable-multibyte-characters nil) setq-default enable-multibyte-characters] 10 (#$ . 9902)]))
(byte-code "\300\301\302\303#\210\300\301\304\305#\207" [put mm-with-unibyte lisp-indent-function 0 edebug-form-spec (body)] 4)
#@42 Return a list of charsets in the region.
(defalias 'mm-find-charset-region #[(b e) "\306\307\"\204 \310\301!\203 	\203 \311\312!\203 \313\314\312\n\"\"\207\310\315!\204K \212\214\n}\210eb\210\316\317w\210m\203: \320\202I \313\317\321\322\f\236!@\206G \323D\"*\207\212\214\n}\210eb\210\324\"\316\317w\210m\203h \325\202x \313\317\321\322\326\236!@\206v \323D\"+\207" [emacs-version enable-multibyte-characters b e mail-parse-charset mm-mime-mule-charset-alist string-match "XEmacs\\|Lucid" boundp fboundp find-charset-region delq composition current-language-environment " -" nil (ascii) ascii last latin-iso8859-1 assoc (ascii) charset language-info-alist entry] 6 (#$ . 10546)])
#@19 Return a charset.
(defalias 'mm-read-charset #[(prompt) "\302\303\304\305	\"\306\307$!\207" [prompt mm-mime-mule-charset-alist intern completing-read mapcar #[(e) "\301@!C\207" [e symbol-name] 2] nil t] 6 (#$ . 11250)])
#@62 Return a version of ARG that is safe to evaluate in a shell.
(defalias 'mm-quote-arg #[(arg) "\304\305\211\306\307\n#\211\203( \n	OB\310B	HCB	T\202 \n\304U\2032 \202= \311\312\237\n\305OC\244\"+\207" [accum new-pos pos arg 0 nil string-match "[]*[;!'`\"$\\& 	{} |()<>]" "\\" apply concat] 6 (#$ . 11478)])
#@63 Return an `auto-mode-alist' with only the .gz (etc) thingies.
(defalias 'mm-auto-mode-alist #[nil "\303\n\203 \n@A<\203 \n@	B\n\211A\210\202 	\237*\207" [auto-mode-alist out alist nil] 2 (#$ . 11808)])
#@58 A list of handlers doing (un)compression (etc) thingies.
(defvar mm-inhibit-file-name-handlers '(jka-compr-handler) (#$ . 12024))
#@370 Like `insert-file-contents', q.v., but only reads in the file.
A buffer may be modified in several ways after reading into the buffer due
to advanced Emacs features, such as file-name-handlers, format decoding,
find-file-hooks, etc.
If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers.
  This function ensures that none of these modifications will take place.
(defalias 'mm-insert-file-contents #[(filename &optional visit beg end replace inhibit) "\306?\205 \307 \310\306\211\211\211\203 \311\202 	\203! \312\n\"\202\" \f\311%.	\207" [inhibit inhibit-file-name-operation mm-inhibit-file-name-handlers inhibit-file-name-handlers find-file-hooks enable-local-eval nil mm-auto-mode-alist fundamental-mode insert-file-contents append after-insert-file-functions enable-local-variables default-major-mode auto-mode-alist format-alist filename visit beg end replace] 11 (#$ . 12161)])
#@352 Append the contents of the region to the end of file FILENAME.
When called from a function, expects three arguments,
START, END and FILENAME.  START and END are buffer positions
saying what text to write.
Optional fourth argument specifies the coding system to use when
encoding the file.
If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers.
(defalias 'mm-append-to-file #[(start end filename &optional codesys inhibit) "\206	 	\206	 \n\203 \306\202 \f\203 \307\"\202  	\306\n\f#+\207" [codesys mm-text-coding-system-for-write mm-text-coding-system inhibit inhibit-file-name-operation mm-inhibit-file-name-handlers append-to-file append inhibit-file-name-handlers coding-system-for-write start end filename] 5 (#$ . 13088)])
#@84 Like `write-region'.
If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers.
(defalias 'mm-write-region #[(start end filename &optional append visit lockname coding-system inhibit) "\206	 	\206	 \n\203 \306\202 \f\203 \307\"\202  	\306\n\f&+\207" [coding-system mm-text-coding-system-for-write mm-text-coding-system inhibit inhibit-file-name-operation mm-inhibit-file-name-handlers write-region append inhibit-file-name-handlers coding-system-for-write start end filename visit lockname] 7 (#$ . 13847)])
(provide 'mm-util)
