"Set buffer-file-coding-system of the current buffer to CODING-SYSTEM."
)
-(defmacro as-binary-process (&rest body)
- (` (let (selective-display) ; Disable ^M to nl translation.
- (,@ body)
- )))
-
-(defmacro as-binary-input-file (&rest body)
- (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
- (,@ body)
- )))
-
-(defmacro as-binary-output-file (&rest body)
- (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
- (,@ body)
- )))
-
;;; @@ for old MULE emulation
;;;
t)
-;;; @ binary access
+;;; @ without code-conversion
;;;
+(defmacro as-binary-process (&rest body)
+ (` (let (selective-display) ; Disable ^M to nl translation.
+ (,@ body)
+ )))
+
+(defmacro as-binary-input-file (&rest body)
+ (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
+ (,@ body)
+ )))
+
+(defmacro as-binary-output-file (&rest body)
+ (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
+ (,@ body)
+ )))
+
+(defun write-region-as-binary (start end filename
+ &optional append visit lockname)
+ "Like `write-region', q.v., but don't code conversion."
+ (let ((emx-binary-mode t))
+ (write-region start end filename append visit lockname)
+ ))
+
(defun insert-file-contents-as-binary (filename
&optional visit beg end replace)
"Like `insert-file-contents', q.v., but don't code and format conversion.
(defalias 'insert-binary-file-contents 'insert-file-contents-as-binary)
(make-obsolete 'insert-binary-file-contents 'insert-file-contents-as-binary)
-(defalias 'insert-file-contents-as-raw-text 'insert-file-contents)
-
(defun insert-binary-file-contents-literally (filename
&optional visit beg end replace)
"Like `insert-file-contents-literally', q.v., but don't code conversion.
(insert-file-contents-literally filename visit beg end replace)
))
-(defun write-region-as-binary (start end filename
- &optional append visit lockname)
- "Like `write-region', q.v., but don't code conversion."
- (let ((emx-binary-mode t))
- (write-region start end filename append visit lockname)
- ))
+(defalias 'insert-file-contents-as-raw-text 'insert-file-contents)
+
+(defun write-region-as-raw-text-CRLF (start end filename
+ &optional append visit lockname)
+ "Like `write-region', q.v., but write as network representation."
+ (let ((the-buf (current-buffer)))
+ (with-temp-buffer
+ (insert-buffer-substring the-buf start end)
+ (goto-char (point-min))
+ (while (re-search-forward "\\([^\r]\\)\n" nil t)
+ (replace-match "\\1\r\n")
+ )
+ (write-region (point-min)(point-max) filename append visit lockname)
+ )))
;;; @ MIME charset
"Encode the text between START and END as MIME CHARSET."
)
-(defun decode-mime-charset-region (start end charset)
+(defun decode-mime-charset-region (start end charset &optional lbt)
"Decode the text between START and END as MIME CHARSET."
+ (cond ((eq lbt 'CRLF)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region start end)
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n"))
+ ))))
)
(defun encode-mime-charset-string (string charset)
"Encode the STRING as MIME CHARSET."
string)
-(defun decode-mime-charset-string (string charset)
+(defun decode-mime-charset-string (string charset &optional lbt)
"Decode the STRING as MIME CHARSET."
- string)
+ (if lbt
+ (with-temp-buffer
+ (insert string)
+ (decode-mime-charset-region (point-min)(point-max) charset lbt)
+ (buffer-string)
+ )
+ string))
(defalias 'write-region-as-mime-charset 'write-region)
"Return number of columns a CHAR occupies when displayed."
1)
+(defun split-char (character)
+ "Return list of charset and one or two position-codes of CHARACTER."
+ (cons (char-charset character) character)
+ )
+
(defalias 'char-length 'char-bytes)
(defmacro char-next-index (char index)