From 4aa277325746edcd23896f02eaccb8d073c8f0b4 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 10 Aug 1998 18:31:03 +0000 Subject: [PATCH] (write-region-as-raw-text-CRLF): New function. --- emu-nemacs.el | 78 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/emu-nemacs.el b/emu-nemacs.el index aeae7a0..b06466f 100644 --- a/emu-nemacs.el +++ b/emu-nemacs.el @@ -164,25 +164,6 @@ (defalias 'set-buffer-file-coding-system 'set-kanji-fileio-code) -(defmacro as-binary-process (&rest body) - (` (let (selective-display ; Disable ^M to nl translation. - ;; NEmacs - kanji-flag - (default-kanji-process-code 0) - program-kanji-code-alist) - (,@ body) - ))) - -(defmacro as-binary-input-file (&rest body) - (` (let (kanji-flag) - (,@ body) - ))) - -(defmacro as-binary-output-file (&rest body) - (` (let (kanji-flag) - (,@ body) - ))) - ;;; @@ for old MULE emulation ;;; @@ -207,9 +188,35 @@ else returns nil. [emu-nemacs.el; Mule emulating function]" )))) -;;; @ binary access +;;; @ without code-conversion ;;; +(defmacro as-binary-process (&rest body) + (` (let (selective-display ; Disable ^M to nl translation. + ;; NEmacs + kanji-flag + (default-kanji-process-code 0) + program-kanji-code-alist) + (,@ body) + ))) + +(defmacro as-binary-input-file (&rest body) + (` (let (kanji-flag) + (,@ body) + ))) + +(defmacro as-binary-output-file (&rest body) + (` (let (kanji-flag) + (,@ body) + ))) + +(defun write-region-as-binary (start end filename + &optional append visit lockname) + "Like `write-region', q.v., but don't code conversion. [emu-nemacs.el]" + (let (kanji-flag) + (write-region start end filename append visit) + )) + (defun insert-file-contents-as-binary (filename &optional visit beg end replace) "Like `insert-file-contents', q.v., but don't character code conversion. @@ -220,14 +227,6 @@ else returns nil. [emu-nemacs.el; Mule emulating function]" (fset 'insert-binary-file-contents 'insert-file-contents-as-binary) -(defun insert-file-contents-as-raw-text (filename - &optional visit beg end replace) - "Like `insert-file-contents', q.v., but don't character code conversion. -\[emu-nemacs.el]" - (let (kanji-flag) - (insert-file-contents filename visit beg end replace) - )) - (defun insert-binary-file-contents-literally (filename &optional visit beg end replace) "Like `insert-file-contents-literally', q.v., but don't code conversion. @@ -240,13 +239,28 @@ find-file-hooks, etc. (insert-file-contents-literally filename visit beg end replace) )) -(defun write-region-as-binary (start end filename - &optional append visit lockname) - "Like `write-region', q.v., but don't code conversion. [emu-nemacs.el]" +(defun insert-file-contents-as-raw-text (filename + &optional visit beg end replace) + "Like `insert-file-contents', q.v., but don't character code conversion. +\[emu-nemacs.el]" (let (kanji-flag) - (write-region start end filename append visit) + (insert-file-contents filename visit beg end replace) )) +(defun write-region-as-raw-text-CRLF (start end filename + &optional append visit lockname) + "Like `write-region', q.v., but don't code conversion. [emu-nemacs.el]" + (let ((the-buf (current-buffer))) + (with-temp-buffer + (insert-buffer-substring the-buf start end) + (goto-char (point-min)) + (while (re-search-forward "\\([^\r]\\)\n" nil t) + (replace-match "\\1\r\n") + ) + (let (kanji-flag) + (write-region (point-min)(point-max) filename append visit) + )))) + ;;; @ MIME charset ;;; -- 1.7.10.4