From: morioka Date: Sat, 10 Oct 1998 01:41:21 +0000 (+0000) Subject: (insert-file-contents-as-binary): New function. X-Git-Tag: apel-9_2~3 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72f4a4b8768decf3ddf3a3e1910df2a99494f135;p=elisp%2Fapel.git (insert-file-contents-as-binary): New function. --- diff --git a/poem-xm.el b/poem-xm.el index 58ab3e2..ed7484e 100644 --- a/poem-xm.el +++ b/poem-xm.el @@ -90,6 +90,35 @@ ;; ) +;;; @ without code-conversion +;;; + +(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) + (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))))) + + ;;; @ buffer representation ;;;