Update.
[elisp/apel.git] / poem-ltn1.el
index f7e23c4..544af55 100644 (file)
@@ -27,6 +27,9 @@
 ;;; @ buffer representation
 ;;;
 
+(eval-when-compile
+  (require 'poe))
+
 (defun-maybe set-buffer-multibyte (flag)
   "Set the multibyte flag of the current buffer to FLAG.
 If FLAG is t, this makes the buffer a multibyte buffer.
@@ -156,12 +159,40 @@ code conversion will not take place."
 
 (defalias 'insert-file-contents-as-raw-text 'insert-file-contents)
 
+(defalias 'insert-file-contents-as-raw-text-CRLF 'insert-file-contents)
+
 (defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but don't code and format conversion."
   (let ((emx-binary-mode t))
     (find-file-noselect filename nowarn rawfile)))
 
-(defalias find-file-noselect-as-raw-text 'find-file-noselect)
+(defalias 'find-file-noselect-as-raw-text 'find-file-noselect)
+
+(defalias 'find-file-noselect-as-raw-text-CRLF '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."
@@ -190,6 +221,10 @@ ignored."
 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
 ;;;