(defvar mm-binary-coding-system
(cond
- ((mm-coding-system-p 'no-conversion) 'no-conversion)
((mm-coding-system-p 'binary) 'binary)
+ ((mm-coding-system-p 'no-conversion) 'no-conversion)
(t nil))
"100% binary coding system.")
(mm-find-charset-region b e)))))
(when (memq 'iso-2022-jp-2 charsets)
(setq charsets (delq 'iso-2022-jp charsets)))
- (delete-duplicates charsets)))
+ (delete-duplicates charsets)
+ (if (and (> (length charsets) 1)
+ (fboundp 'find-coding-systems-for-charsets)
+ (memq 'utf-8 (find-coding-systems-for-charsets charsets)))
+ '(utf-8)
+ charsets)))
(defsubst mm-multibyte-p ()
"Say whether multibyte is enabled."
- (and (boundp 'enable-multibyte-characters)
- enable-multibyte-characters))
+ (or (string-match "XEmacs\\|Lucid" emacs-version)
+ (and (boundp 'enable-multibyte-characters)
+ enable-multibyte-characters)))
(defmacro mm-with-unibyte-buffer (&rest forms)
"Create a temporary buffer, and evaluate FORMS there like `progn'.
See also `with-temp-file' and `with-output-to-string'."
(let ((temp-buffer (make-symbol "temp-buffer"))
(multibyte (make-symbol "multibyte")))
- `(if (not (boundp 'enable-multibyte-characters))
+ `(if (or (string-match "XEmacs\\|Lucid" emacs-version)
+ (not (boundp 'enable-multibyte-characters)))
(with-temp-buffer ,@forms)
(let ((,multibyte (default-value 'enable-multibyte-characters))
,temp-buffer)
(defun mm-find-charset-region (b e)
"Return a list of charsets in the region."
(cond
- ((and (boundp 'enable-multibyte-characters)
- enable-multibyte-characters
+ ((and (mm-multibyte-p)
(fboundp 'find-charset-region))
(find-charset-region b e))
((not (boundp 'current-language-environment))