From: yamaoka Date: Wed, 12 Aug 1998 11:18:39 +0000 (+0000) Subject: emu-nemacs.el, emu-mule.el (decode-mime-charset-{region|string}): Add new argument... X-Git-Tag: apel-8_16~23 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c7760f3ad3f7a61057a152d81c4d0ad9f6456ba;p=elisp%2Fapel.git emu-nemacs.el, emu-mule.el (decode-mime-charset-{region|string}): Add new argument `lbt'. --- diff --git a/ChangeLog b/ChangeLog index 3b01975..fb849ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1998-08-12 Katsumi Yamaoka + + * emu-nemacs.el, emu-mule.el (decode-mime-charset-region): Add new + argument `lbt'. + (decode-mime-charset-string): Likewise. + + * emu-mule.el (mime-charset-to-coding-system): Regard `CRLF', + `LF', `CR' as line break code type. + 1998-08-11 MORIOKA Tomohiko * emu-latin1.el, emu-nemacs.el (write-region-as-raw-text-CRLF): @@ -17,7 +26,7 @@ * emu-mule.el (write-region-as-raw-text-CRLF): New function. * emu-18.el (generate-new-buffer-name): New function (Emacs 19 - mulating function). + emulating function). 1998-08-10 MORIOKA Tomohiko @@ -315,7 +324,7 @@ * APEL: Version 8.4 was released. - * EMU-ELS: Don't use HIRAGANA LETTER A ($(B$"(B) to detect character + * EMU-ELS: Don't use HIRAGANA LETTER A ($B$"(B) to detect character indexing (Emacs 20.3 or later). 1998-04-20 MORIOKA Tomohiko diff --git a/emu-mule.el b/emu-mule.el index 6c31639..6af919f 100644 --- a/emu-mule.el +++ b/emu-mule.el @@ -235,9 +235,9 @@ find-file-hooks, etc. (code-convert start end *internal* cs) ))) -(defun decode-mime-charset-region (start end charset) +(defun decode-mime-charset-region (start end charset &optional lbt) "Decode the text between START and END as MIME CHARSET." - (let ((cs (mime-charset-to-coding-system charset))) + (let ((cs (mime-charset-to-coding-system charset lbt))) (if cs (code-convert start end cs *internal*) ))) @@ -249,9 +249,9 @@ find-file-hooks, etc. (code-convert-string string *internal* cs) string))) -(defun decode-mime-charset-string (string charset) +(defun decode-mime-charset-string (string charset &optional lbt) "Decode the STRING which is encoded in MIME CHARSET." - (let ((cs (mime-charset-to-coding-system charset))) + (let ((cs (mime-charset-to-coding-system charset lbt))) (if cs (decode-coding-string string cs) string))) @@ -291,7 +291,10 @@ find-file-hooks, etc. (if (or (null lbt) (null cs)) cs - (intern (concat (symbol-name cs) (symbol-name lbt))) + (intern (format "%s%s" cs (cond ((eq lbt 'CRLF) 'dos) + ((eq lbt 'LF) 'unix) + ((eq lbt 'CR) 'mac) + (t lbt)))) ))) diff --git a/emu-nemacs.el b/emu-nemacs.el index 1c53e14..7f0b15b 100644 --- a/emu-nemacs.el +++ b/emu-nemacs.el @@ -307,16 +307,23 @@ find-file-hooks, etc. )) )))) -(defun decode-mime-charset-region (start end charset) +(defun decode-mime-charset-region (start end charset &optional lbt) "Decode the text between START and END as MIME CHARSET. \[emu-nemacs.el]" - (let ((cs (mime-charset-to-coding-system charset))) + (let ((cs (mime-charset-to-coding-system charset)) + (nl (cdr (assq lbt '((CRLF . "\r\n") (CR . "\r") + (dos . "\r\n") (mac . "\r")))))) (and (numberp cs) (or (= cs 3) (save-excursion (save-restriction (narrow-to-region start end) (convert-region-kanji-code start end cs 3) + (if nl + (progn + (goto-char (point-min)) + (while (search-forward nl nil t) + (replace-match "\n")))) )) )))) @@ -327,12 +334,12 @@ find-file-hooks, etc. (convert-string-kanji-code string 3 cs) string))) -(defun decode-mime-charset-string (string charset) +(defun decode-mime-charset-string (string charset &optional lbt) "Decode the STRING as MIME CHARSET. [emu-nemacs.el]" - (let ((cs (mime-charset-to-coding-system charset))) - (if cs - (convert-string-kanji-code string cs 3) - string))) + (with-temp-buffer + (insert string) + (decode-mime-charset-region (point-min)(point-max) charset lbt) + (buffer-string))) (defun write-region-as-mime-charset (charset start end filename) "Like `write-region', q.v., but code-convert by MIME CHARSET.