Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
morioka committed Dec 23, 1998
1 parent 4865730 commit 6398229
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 92 deletions.
49 changes: 1 addition & 48 deletions ChangeLog
@@ -1,50 +1,3 @@
1999-01-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>

* mcs-20.el (mime-charset-to-coding-system-default-method): New
user option.
(mime-charset-to-coding-system): Call
`mime-charset-to-coding-system-default-method' if suitable
coding-system is not found.

1999-01-21 Keiichi Suzuki <kei-suzu@mail.wbs.ne.jp>

* mcs-xm.el (encode-mime-charset-region): Add new optional
argument `lbt'.
(encode-mime-charset-string): Ditto.

* mcs-nemacs.el (lbt-to-string): New inline function.
(encode-mime-charset-region): Add new optional argument `lbt'.
(encode-mime-charset-string): Ditto.

* mcs-ltn1.el (lbt-to-string): New inline function.
(encode-mime-charset-region): Add new optional argument `lbt'.
(encode-mime-charset-string): Ditto.
(decode-mime-charset-region): Use `lbt-to-string'.

* mcs-e20.el (encode-mime-charset-region): Add new optional
argument `lbt'.
(encode-mime-charset-string): Ditto.

* mcs-om.el (lbt-to-string): New inline function.
(encode-mime-charset-region): Add new optional argument `lbt'.
(encode-mime-charset-string): Ditto.
(decode-mime-charset-region): Use `lbt-to-string'.
(decode-mime-charset-string): Ditto.

1998-12-24 MORIOKA Tomohiko <morioka@jaist.ac.jp>

* mcs-om.el (default-mime-charset-for-write): New variable.
(detect-mime-charset-region): Return
`default-mime-charset-for-write' if suitable mime-charset is not
found.

* mcs-20.el (detect-mime-charset-region): Don't call
`default-mime-charset-detect-method-for-write' if suitable
mime-charset is found.

* mcharset.el (charsets-to-mime-charset): Return nil if suitable
mime-charset is not found; abolish optional argument `default'.

1998-12-23 MORIOKA Tomohiko <morioka@jaist.ac.jp>

* mcs-xm.el (charsets-mime-charset-alist): Don't set up
Expand Down Expand Up @@ -1276,7 +1229,7 @@
1998-04-27 MORIOKA Tomohiko <morioka@jaist.ac.jp>

* calist.el (ctree-find-calist): Renamed from
'ctree-match-calist-all.
'ctree-match-calist-all.


1998-04-25 MORIOKA Tomohiko <morioka@jaist.ac.jp>
Expand Down
64 changes: 24 additions & 40 deletions mcs-20.el
@@ -1,6 +1,6 @@
;;; mcs-20.el --- MIME charset implementation for Emacs 20 and XEmacs/mule

;; Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
;; Copyright (C) 1997,1998 Free Software Foundation, Inc.

;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Keywords: emulation, compatibility, Mule
Expand Down Expand Up @@ -61,14 +61,6 @@ MIME CHARSET and CODING-SYSTEM must be symbol."
:group 'i18n
:type '(repeat (cons symbol coding-system)))

(defcustom mime-charset-to-coding-system-default-method
nil
"Function called when suitable coding-system is not found from MIME-charset.
It must be nil or function.
If it is a function, interface must be (CHARSET LBT CODING-SYSTEM)."
:group 'i18n
:type '(choice function (const nil)))

(defsubst mime-charset-to-coding-system (charset &optional lbt)
"Return coding-system corresponding with CHARSET.
CHARSET is a symbol whose name is MIME charset.
Expand All @@ -77,24 +69,20 @@ is specified, it is used as line break code type of coding-system."
(if (stringp charset)
(setq charset (intern (downcase charset)))
)
(let ((cs (assq charset mime-charset-coding-system-alist)))
(setq cs
(if cs
(cdr cs)
charset))
(if lbt
(setq cs (intern (format "%s-%s" cs
(cond ((eq lbt 'CRLF) 'dos)
((eq lbt 'LF) 'unix)
((eq lbt 'CR) 'mac)
(t lbt)))))
)
(if (find-coding-system cs)
cs
(if mime-charset-to-coding-system-default-method
(funcall mime-charset-to-coding-system-default-method
charset lbt cs)
))))
(let ((ret (assq charset mime-charset-coding-system-alist)))
(if ret
(setq charset (cdr ret))
))
(if lbt
(setq charset (intern (format "%s-%s" charset
(cond ((eq lbt 'CRLF) 'dos)
((eq lbt 'LF) 'unix)
((eq lbt 'CR) 'mac)
(t lbt)))))
)
(if (find-coding-system charset)
charset
))

(defvar widget-mime-charset-prompt-value-history nil
"History of input to `widget-mime-charset-prompt-value'.")
Expand Down Expand Up @@ -140,31 +128,27 @@ It must be symbol."
'utf-8
default-mime-charset)
"Default value of MIME-charset for encoding.
It may be used when suitable MIME-charset is not found.
It is used when MIME-charset is not specified.
It must be symbol."
:group 'i18n
:type 'mime-charset)

(defcustom default-mime-charset-detect-method-for-write
nil
"Function called when suitable MIME-charset is not found to encode.
It must be nil or function.
If it is nil, variable `default-mime-charset-for-write' is used.
If it is a function, interface must be (TYPE CHARSETS &rest ARGS).
CHARSETS is list of charset.
If TYPE is 'region, ARGS has START and END."
"Function called when suitable MIME-charset is not found to encode."
:group 'i18n
:type '(choice function (const nil)))

(defun detect-mime-charset-region (start end)
"Return MIME charset for region between START and END."
(let ((charsets (find-charset-region start end)))
(or (charsets-to-mime-charset charsets)
(if default-mime-charset-detect-method-for-write
(funcall default-mime-charset-detect-method-for-write
'region charsets start end)
default-mime-charset-for-write)
)))
(charsets-to-mime-charset
charsets
(if default-mime-charset-detect-method-for-write
(funcall default-mime-charset-detect-method-for-write
'region start end charsets)
default-mime-charset-for-write)
)))

(defun write-region-as-mime-charset (charset start end filename
&optional append visit lockname)
Expand Down
8 changes: 4 additions & 4 deletions mcs-xm.el
Expand Up @@ -32,9 +32,9 @@
(require 'mcs-20)


(defun encode-mime-charset-region (start end charset &optional lbt)
(defun encode-mime-charset-region (start end charset)
"Encode the text between START and END as MIME CHARSET."
(let ((cs (mime-charset-to-coding-system charset lbt)))
(let ((cs (mime-charset-to-coding-system charset)))
(if cs
(encode-coding-region start end cs)
)))
Expand Down Expand Up @@ -125,9 +125,9 @@
(assq t mime-charset-decoder-alist)))))
(funcall func start end charset lbt)))

(defsubst encode-mime-charset-string (string charset &optional lbt)
(defsubst encode-mime-charset-string (string charset)
"Encode the STRING as MIME CHARSET."
(let ((cs (mime-charset-to-coding-system charset lbt)))
(let ((cs (mime-charset-to-coding-system charset)))
(if cs
(encode-coding-string string cs)
string)))
Expand Down

0 comments on commit 6398229

Please sign in to comment.