[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eol なしの coding-systemの eol type の扱い



返事遅れてすみません。

In article <20060502.152024.68478244.shirai.hideyuki@xxxxxxxxxxxxxxxxxxx>, Hideyuki SHIRAI (白井秀行) <shirai@xxxxxxxxxxx> writes:

> 例えば、思いっきり簡略化していますが、Mew の body に ^M がつくの
> は以下のような感じのコードになっているからです。

> (let ((buf (get-buffer-create "*tmp"))
>       (file (expand-file-name "tmp.txt" "/tmp"))
>       pos)
>   (set-buffer buf)
>   (erase-buffer)
>   (setq buffer-file-coding-system 'ctext-unix)
>   (insert "Header area is
> not convert, so ascii only.
> ")
>   (setq pos (point))
>   (insert "本文は適切な CS で
> 変換する
> ")
>   (encode-coding-region pos (point-max) 'iso-2022-jp)
>   (let ((coding-system-for-write 'raw-text-unix))
>     (write-region (point-min) (point-max) file)))

うーむ、確かにこういう使用例は他にも多そうですねぇ。とりあえ
ず system_eol_type は、

/* Format of end-of-line decided by system.  This is CODING_EOL_LF on
   Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac.
   This has an effect only for external encoding (i.e. for output to
   file and process), not for in-buffer or Lisp string encoding.  */
int system_eol_type;

という意味付けにしました。つまり encode-coding-string や
encode-coding-region を Lisp から呼ぶ限りは、以前と同じ動作
に戻しました。

---
半田@AIST