;;; @ 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.
(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."
;;;
(defun insert-file-contents-as-coding-system
- (filename coding-system &optional visit beg end replace)
- "Like `insert-file-contents', q.v., but CODING-SYSTEM the second arg will
-be applied to `coding-system-for-read'."
+ (coding-system filename &optional visit beg end replace)
+ "Like `insert-file-contents', q.v., CODING-SYSTEM the first arg will be
+ignored."
(insert-file-contents filename visit beg end replace))
-(defun write-region-as-coding-system (start end filename coding-system
- &optional append visit lockname)
- "Like `write-region', q.v., but CODING-SYSTEM the fourth arg will be
-applied to `coding-system-for-write'."
+(defun write-region-as-coding-system
+ (coding-system start end filename &optional append visit lockname)
+ "Like `write-region', q.v., CODING-SYSTEM the first arg will be ignored."
(let (jka-compr-compression-info-list jam-zcat-filename-list)
(write-region start end filename append visit lockname)))
-(defun find-file-noselect-as-coding-system (filename coding-system
- &optional nowarn rawfile)
- "Like `find-file-noselect', q.v., but CODING-SYSTEM the second arg will
-be applied to `coding-system-for-read'."
+(defun find-file-noselect-as-coding-system
+ (coding-system filename &optional nowarn rawfile)
+ "Like `find-file-noselect', q.v., CODING-SYSTEM the first arg will be
+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
;;;