update.
[elisp/apel.git] / poem-20.el
index 1052dd8..f304951 100644 (file)
@@ -70,6 +70,18 @@ code."
     ;; Returns list of absolute file name and length of data inserted.
     (insert-file-contents filename visit beg end replace)))
 
+(defun insert-file-contents-as-raw-text-CRLF (filename
+                                             &optional visit beg end replace)
+  "Like `insert-file-contents', q.v., but don't code and format conversion.
+Like `insert-file-contents-literary', but it allows find-file-hooks,
+automatic uncompression, etc.
+Like `insert-file-contents-as-binary', but it converts line-break code
+from CRLF to LF."
+  (let ((coding-system-for-read 'raw-text-dos)
+       format-alist)
+    ;; Returns list of absolute file name and length of data inserted.
+    (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 write as network representation."
@@ -78,7 +90,7 @@ code."
 
 (defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but don't code and format conversion."
-  (let ((coding-system-for-write 'binary)
+  (let ((coding-system-for-read 'binary)
        format-alist)
     (find-file-noselect filename nowarn rawfile)))
 
@@ -89,6 +101,23 @@ except for line-break code."
        format-alist)
     (find-file-noselect filename nowarn rawfile)))
 
+(defun find-file-noselect-as-raw-text-CRLF (filename &optional nowarn rawfile)
+  "Like `find-file-noselect', q.v., but it does not code and format conversion
+except for line-break code."
+  (let ((coding-system-for-read 'raw-text-dos)
+       format-alist)
+    (find-file-noselect filename nowarn rawfile)))
+
+(defun save-buffer-as-binary (&optional args)
+  "Like `save-buffer', q.v., but don't encode."
+  (let ((coding-system-for-write 'binary))
+    (save-buffer args)))
+
+(defun save-buffer-as-raw-text-CRLF (&optional args)
+  "Like `save-buffer', q.v., but save as network representation."
+  (let ((coding-system-for-write 'raw-text-dos))
+    (save-buffer args)))
+
 (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)
@@ -99,32 +128,35 @@ except for line-break code."
 ;;; @ 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)))
+(defun insert-file-contents-as-coding-system
+  (coding-system filename &optional visit beg end replace)
+  "Like `insert-file-contents', q.v., but CODING-SYSTEM the first arg will
+be applied to `coding-system-for-read'."
+  (let ((coding-system-for-read coding-system)
        format-alist)
-    (apply 'insert-file-contents filename (nreverse (cdr (nreverse args))))))
+    (insert-file-contents filename visit beg end replace)))
 
-(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)))
+(defun write-region-as-coding-system
+  (coding-system start end filename &optional append visit lockname)
+  "Like `write-region', q.v., but CODING-SYSTEM the first arg will be
+applied to `coding-system-for-write'."
+  (let ((coding-system-for-write coding-system)
        jka-compr-compression-info-list jam-zcat-filename-list)
-    (apply 'write-region start end filename
-          (nreverse (cdr (nreverse args))))))
-
-(defun find-file-noselect-as-specified-coding-system (filename &optional args)
-  "Like `find-file-noselect', q.v., but code convert by the specified
-coding-system. ARGS the optional arguments are passed to `find-file-noselect'
-except for the last element. The last element of ARGS must be a
-coding-system."
-  (let ((coding-system-for-read (car (reverse args)))
+    (write-region start end filename append visit lockname)))
+
+(defun find-file-noselect-as-coding-system
+  (coding-system filename &optional nowarn rawfile)
+  "Like `find-file-noselect', q.v., but CODING-SYSTEM the first arg will
+be applied to `coding-system-for-read'."
+  (let ((coding-system-for-read coding-system)
        format-alist)
-    (apply' find-file-noselect filename (nreverse (cdr (nreverse args))))))
+    (find-file-noselect filename nowarn rawfile)))
+
+(defun save-buffer-as-coding-system (coding-system &optional args)
+  "Like `save-buffer', q.v., but CODING-SYSTEM the first arg will be
+applied to `coding-system-for-write'."
+  (let ((coding-system-for-write coding-system))
+    (save-buffer args)))
 
 
 ;;; @ end