From bcd4799feff8d1a14ca63fd7cc207c227dc1b278 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 7 Jun 1999 10:51:05 +0000 Subject: [PATCH] (insert-file-contents-literally-treats-binary): Moved to pces-20.el. (insert-file-contents-literally-treats-file-name-handler): Likewise. (insert-file-contents-as-binary): Likewise. --- pces-xfc.el | 83 +++-------------------------------------------------------- 1 file changed, 4 insertions(+), 79 deletions(-) diff --git a/pces-xfc.el b/pces-xfc.el index b3385a0..8944509 100644 --- a/pces-xfc.el +++ b/pces-xfc.el @@ -24,16 +24,6 @@ ;;; Code: -(require 'pces-20) - -(if (featurep 'mule) - (require 'pces-xm) - ) - - -;;; @ fix coding-system definition -;;; - ;; Redefine if -{dos|mac|unix} is not found. (or (find-coding-system 'raw-text-dos) (copy-coding-system 'no-conversion-dos 'raw-text-dos)) @@ -42,77 +32,12 @@ (or (find-coding-system 'raw-text-unix) (copy-coding-system 'no-conversion-unix 'raw-text-unix)) - -;;; @ without code-conversion -;;; - -(require 'broken) - -(broken-facility insert-file-contents-literally-treats-binary - "Function `insert-file-contents-literally' decodes text." - (let ((str "\xa1\xa3") - (coding-system-for-write 'binary) - (coding-system-for-read 'euc-jp)) - (with-temp-buffer - (insert str) - (write-region (point-min)(point-max) "literal-test-file") - ) - (string= - (with-temp-buffer - (let (file-name-handler-alist) - (insert-file-contents-literally "literal-test-file") - ) - (buffer-string) - ) - str))) - -(broken-facility insert-file-contents-literally-treats-file-name-handler - "Function `insert-file-contents' doesn't call file-name-handler." - (let (called) - (with-temp-buffer - (let ((file-name-handler-alist - '(("literal-test-file" . (lambda (operation &rest args) - (setq called t) - (let (file-name-handler-alist) - (apply operation args) - )))))) - (insert-file-contents-literally "literal-test-file") - ) - (delete-file "literal-test-file") - ) - called)) - -(static-if - (or (broken-p 'insert-file-contents-literally-treats-binary) - (broken-p 'insert-file-contents-literally-treats-file-name-handler)) - (defun insert-file-contents-as-binary (filename - &optional visit beg end replace) - "Like `insert-file-contents', but only reads in the file literally. -A buffer may be modified in several ways after reading into the buffer, -to Emacs features such as format decoding, character code -conversion, find-file-hooks, automatic uncompression, etc. - -This function ensures that none of these modifications will take place." - (let ((format-alist nil) - (after-insert-file-functions nil) - (coding-system-for-read 'binary) - (coding-system-for-write 'binary) - (jka-compr-compression-info-list nil) - (jam-zcat-filename-list nil) - (find-buffer-file-type-function - (if (fboundp 'find-buffer-file-type) - (symbol-function 'find-buffer-file-type) - nil))) - (unwind-protect - (progn - (fset 'find-buffer-file-type (lambda (filename) t)) - (insert-file-contents filename visit beg end replace)) - (if find-buffer-file-type-function - (fset 'find-buffer-file-type find-buffer-file-type-function) - (fmakunbound 'find-buffer-file-type))))) - (defalias 'insert-file-contents-as-binary 'insert-file-contents-literally) +(if (featurep 'mule) + (require 'pces-xm) ) +(require 'pces-20) + ;;; @ end ;;; -- 1.7.10.4