From: yamaoka Date: Fri, 4 Dec 1998 05:54:06 +0000 (+0000) Subject: * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el X-Git-Tag: apel-199812041900~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=dc80c7cbc92015f8fd00993895243f2a537259af;p=elisp%2Fapel.git * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el (open-network-stream-as-binary): New function. * poem-e20_2.el (insert-file-contents-as-specified-coding-system): New function. * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el (write-region-as-specified-coding-system): New function. (insert-file-contents-as-specified-coding-system): New function. --- diff --git a/ChangeLog b/ChangeLog index 5db4e7d..bb5bdf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1998-12-04 Katsumi Yamaoka + + * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el + (open-network-stream-as-binary): New function. + + * poem-e20_2.el (insert-file-contents-as-specified-coding-system): + New function. + + * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el + (write-region-as-specified-coding-system): New function. + (insert-file-contents-as-specified-coding-system): New function. + 1998-12-01 MORIOKA Tomohiko * poem-xm.el: If coding-system `iso-2022-jp-dos' unifies JIS X diff --git a/poem-20.el b/poem-20.el index 5c8cbfc..a8ae858 100644 --- a/poem-20.el +++ b/poem-20.el @@ -76,6 +76,35 @@ code." (let ((coding-system-for-write 'raw-text-dos)) (write-region start end filename append visit lockname))) +(defun open-network-stream-as-binary (name buffer host service) + "Like `open-network-stream', q.v., but don't code conversion." + (let ((coding-system-for-read 'binary) + (coding-system-for-write 'binary)) + (open-network-stream name buffer host service))) + + +;;; @ with code-conversion +;;; + +(defun insert-file-contents-as-specified-coding-system (filename &rest args) + "Like `insert-file-contents', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to +`insert-file-contents' except for the last element. The last element of +ARGS must be a coding-system." + (let ((coding-system-for-read (car (reverse args))) + format-alist) + (apply 'insert-file-contents filename (nreverse (cdr (nreverse args)))))) + +(defun write-region-as-specified-coding-system (start end filename + &rest args) + "Like `write-region', q.v., but code convert by the specified coding-system. +ARGS the optional arguments are passed to `write-region' except for the last +element. The last element of ARGS must be a coding-system." + (let ((coding-system-for-write (car (reverse args))) + jka-compr-compression-info-list jam-zcat-filename-list) + (apply 'write-region start end filename + (nreverse (cdr (nreverse args)))))) + ;;; @ end ;;; diff --git a/poem-e20_2.el b/poem-e20_2.el index 908a20e..f2009a5 100644 --- a/poem-e20_2.el +++ b/poem-e20_2.el @@ -121,6 +121,23 @@ code." (set-buffer-multibyte flag)))) +;;; @ with code-conversion +;;; + +(defun insert-file-contents-as-specified-coding-system (filename &rest args) + "Like `insert-file-contents', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to +`insert-file-contents' except for the last element. The last element of +ARGS must be a coding-system." + (let ((flag enable-multibyte-characters) + (coding-system-for-read (car (reverse args))) + format-alist) + (prog1 + (apply 'insert-file-contents filename + (nreverse (cdr (nreverse args)))) + (set-buffer-multibyte flag)))) + + ;;; @ end ;;; diff --git a/poem-ltn1.el b/poem-ltn1.el index be435c6..b77a159 100644 --- a/poem-ltn1.el +++ b/poem-ltn1.el @@ -156,6 +156,31 @@ code conversion will not take place." (defalias 'insert-file-contents-as-raw-text 'insert-file-contents) +(defun open-network-stream-as-binary (name buffer host service) + "Like `open-network-stream', q.v., but don't code conversion." + (let ((emx-binary-mode t)) + (open-network-stream name buffer host service))) + + +;;; @ with code-conversion (but actually it might be not done) +;;; + +(defun insert-file-contents-as-specified-coding-system (filename &rest args) + "Like `insert-file-contents', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to +`insert-file-contents' except for the last element. The last element of +ARGS must be a coding-system." + (apply 'insert-file-contents filename (nreverse (cdr (nreverse args))))) + +(defun write-region-as-specified-coding-system (start end filename + &rest args) + "Like `write-region', q.v., but code convert by the specified coding-system. +ARGS the optional arguments are passed to `write-region' except for the last +element. The last element of ARGS must be a coding-system." + (let (jka-compr-compression-info-list jam-zcat-filename-list) + (apply 'write-region start end filename + (nreverse (cdr (nreverse args)))))) + ;;; @ character ;;; diff --git a/poem-nemacs.el b/poem-nemacs.el index 6738d19..ad4b55e 100644 --- a/poem-nemacs.el +++ b/poem-nemacs.el @@ -222,6 +222,35 @@ (write-region-as-binary (point-min)(point-max) filename append visit)))) +(defun open-network-stream-as-binary (name buffer host service) + "Like `open-network-stream', q.v., but don't code conversion." + (let ((process (open-network-stream name buffer host service))) + (set-process-kanji-code process 0) + process)) + + +;;; @ with code-conversion +;;; + +(defun insert-file-contents-as-specified-coding-system (filename &rest args) + "Like `insert-file-contents', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to +`insert-file-contents' except for the last element. The last element of +ARGS must be a coding-system." + (let ((kanji-fileio-code (car (reverse args))) + kanji-expected-code) + (apply' insert-file-contents filename (nreverse (cdr (nreverse args)))))) + +(defun write-region-as-specified-coding-system (start end filename + &rest args) + "Like `write-region', q.v., but code convert by the specified coding-system. +ARGS the optional arguments are passed to `write-region' except for the last +element. The last element of ARGS must be a coding-system." + (let ((kanji-fileio-code (car (reverse args))) + jka-compr-compression-info-list jam-zcat-filename-list) + (apply 'write-region start end filename + (nreverse (cdr (nreverse args)))))) + ;;; @ buffer representation ;;; diff --git a/poem-om.el b/poem-om.el index 4c3f13e..6ca69e6 100644 --- a/poem-om.el +++ b/poem-om.el @@ -224,6 +224,52 @@ find-file-hooks, etc. filename append visit)))) )) +(defun open-network-stream-as-binary (name buffer host service) + "Like `open-network-stream', q.v., but don't code conversion." + (let ((process (open-network-stream name buffer host service))) + (set-process-coding-system process *noconv* *noconv*) + process)) + + +;;; @ with code-conversion +;;; + +(defun insert-file-contents-as-specified-coding-system (filename &rest args) + "Like `insert-file-contents', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to +`insert-file-contents' except for the last element. The last element of +ARGS must be a coding-system." + (let ((file-coding-system-for-read (car (reverse args)))) + (apply 'insert-file-contents filename (nreverse (cdr (nreverse args)))))) + +(cond + (running-emacs-19_29-or-later + ;; for MULE 2.3 based on Emacs 19.34. + (defun write-region-as-specified-coding-system (start end filename + &rest args) + "Like `write-region', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to `write-region' +except for the last element. The last element of ARGS must be a +coding-system." + (let ((file-coding-system (car (reverse args))) + jka-compr-compression-info-list jam-zcat-filename-list) + (apply 'write-region start end filename + (nreverse (cdr (nreverse args)))))) + ) + (t + ;; for MULE 2.3 based on Emacs 19.28. + (defun write-region-as-specified-coding-system (start end filename + &rest args) + "Like `write-region', q.v., but code convert by the specified +coding-system. ARGS the optional arguments are passed to `write-region' +except for the last element. The last element of ARGS must be a +coding-system." + (let ((code (car (reverse args))) + (args (nreverse (cdr (nreverse args)))) + jka-compr-compression-info-list jam-zcat-filename-list) + (write-region start end filename (car args) (car (cdr args)) code))) + )) + ;;; @ buffer representation ;;;