1999-02-04 Katsumi Yamaoka <yamaoka@jpl.org>
+ * poem-20.el, poem-ltn1.el, poem-nemacs.el, poem-om.el
+ (save-buffer-as-binary): New function.
+ (save-buffer-as-raw-text-CRLF): New function.
+ (save-buffer-as-coding-system): New function.
+
+ * poem-om.el (poem-ccl-decode-raw-text): Rewrite again for plural
+ `CR's.
+
+1999-02-04 Katsumi Yamaoka <yamaoka@jpl.org>
+
* poem-om.el (poem-ccl-decode-raw-text): Rewrite for fixing a bug
that the last datum will be missed if the input data is not ended
with `CRLF'.
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)
format-alist)
(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
;;;
(defalias find-file-noselect-as-raw-text 'find-file-noselect)
+(defun save-buffer-as-binary (&optional args)
+ "Like `save-buffer', q.v., but don't encode."
+ (let ((emx-binary-mode t))
+ (save-buffer args)))
+
+(defun save-buffer-as-raw-text-CRLF (&optional args)
+ "Like `save-buffer', q.v., but save as network representation."
+ (if (buffer-modified-p)
+ (save-restriction
+ (widen)
+ (let ((the-buf (current-buffer))
+ (filename (buffer-file-name)))
+ (if filename
+ (prog1
+ (with-temp-buffer
+ (insert-buffer the-buf)
+ (goto-char (point-min))
+ (while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
+ (replace-match "\\1\r\n"))
+ (setq buffer-file-name filename)
+ (save-buffer args))
+ (set-buffer-modified-p nil)
+ (clear-visited-file-modtime)))))))
+
(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))
ignored."
(find-file-noselect filename nowarn rawfile))
+(defun save-buffer-as-coding-system (coding-system &optional args)
+ "Like `save-buffer', q.v., CODING-SYSTEM the first arg will be ignored."
+ (save-buffer args))
+
;;; @ character
;;;
(set-process-kanji-code process 0)
process))
+(defun save-buffer-as-binary (&optional args)
+ "Like `save-buffer', q.v., but don't encode."
+ (as-binary-output-file
+ (save-buffer args)))
+
+(defun save-buffer-as-raw-text-CRLF (&optional args)
+ "Like `save-buffer', q.v., but save as network representation."
+ (if (buffer-modified-p)
+ (save-restriction
+ (widen)
+ (let ((the-buf (current-buffer))
+ (filename (buffer-file-name)))
+ (if filename
+ (prog1
+ (with-temp-buffer
+ (insert-buffer the-buf)
+ (goto-char (point-min))
+ (while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
+ (replace-match "\\1\r\n"))
+ (setq buffer-file-name filename)
+ (save-buffer-as-binary args))
+ (set-buffer-modified-p nil)
+ (clear-visited-file-modtime)))))))
+
;;; @ with code-conversion
;;;
kanji-expected-code)
(find-file-noselect filename nowarn)))
+(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 `kanji-fileio-code'."
+ (let ((kanji-fileio-code coding-system))
+ (save-buffer args)))
+
;;; @ buffer representation
;;;
(define-ccl-program poem-ccl-decode-raw-text
'(1
- (loop
- (read-if (r0 == ?\x0d)
- (read-if (r1 == ?\x0a)
- (write r1)
- ((write r0)
- (write r1)))
- (write r0))
- (repeat)))
+ ((r2 = 0)
+ (read r0)
+ (loop
+ (if (r0 == ?\x0d)
+ ((r2 = 1)
+ (read-if (r1 == ?\x0a)
+ ((r0 = ?\x0a)
+ (r2 = 0)
+ (write-read-repeat r0))
+ ((write r0)
+ (r0 = (r1 + 0))
+ (repeat))))
+ ((r2 = 0)
+ (write-read-repeat r0)))))
+ ;; This EOF BLOCK won't work out in practice. So the last datum
+ ;; might be lost if it's value is ?\x0d.
+ (if r2
+ (write r0))
+ )
"Convert line-break code from CRLF to LF.")
(define-ccl-program poem-ccl-encode-raw-text
(find-file-noselect filename nowarn)))
))
+(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 ((file-coding-system coding-system))
+ (save-buffer args)))
+
;;; @ without code-conversion
;;;
(write-region-as-coding-system 'raw-text-dos
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 ((process (open-network-stream name buffer host service)))
- (set-process-coding-system process *noconv* *noconv*)
- process))
-
(defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
"Like `find-file-noselect', q.v., but don't code and format conversion."
(find-file-noselect-as-coding-system 'binary filename nowarn rawfile))
conversion except for line-break code."
(find-file-noselect-as-coding-system 'raw-text filename nowarn rawfile))
+(defun save-buffer-as-binary (&optional args)
+ "Like `save-buffer', q.v., but don't encode."
+ (let ((file-coding-system 'binary))
+ (save-buffer args)))
+
+(defun save-buffer-as-raw-text-CRLF (&optional args)
+ "Like `save-buffer', q.v., but save as network representation."
+ (let ((file-coding-system '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 ((process (open-network-stream name buffer host service)))
+ (set-process-coding-system process *noconv* *noconv*)
+ process))
+
;;; @ buffer representation
;;;