Function: woman-insert-file-contents

woman-insert-file-contents is a byte-compiled function defined in woman.el.gz.

Signature

(woman-insert-file-contents FILENAME COMPRESSED)

Documentation

Insert file FILENAME into the current buffer.

If COMPRESSED is t, or is non-nil and the filename implies compression, then turn on auto-compression mode to decompress the file. Leave point at end of new text. Return length of inserted text.

Source Code

;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-insert-file-contents (filename compressed)
  "Insert file FILENAME into the current buffer.
If COMPRESSED is t, or is non-nil and the filename implies compression,
then turn on auto-compression mode to decompress the file.
Leave point at end of new text.  Return length of inserted text."
  ;; Leaves point at end of inserted text in GNU Emacs 20.3, but at
  ;; start in 19.34!
  (save-excursion
    (let ((case-fold-search t))
      ;; Cooperate with auto-compression mode:
      (if (and compressed
	       (or (eq compressed t)
		   (string-match-p woman-file-compression-regexp filename))
	       ;; (not auto-compression-mode)
	       (not (rassq 'jka-compr-handler file-name-handler-alist)) )
	  ;; (error "Compressed file requires Auto File Decompression turned on")
	  (auto-compression-mode 1))
      (nth 1
	   (condition-case ()
	       (insert-file-contents filename nil)
	     (file-error
	      ;; Run find-file-not-found-functions until one returns non-nil.
	      ;; (run-hook-with-args-until-success 'find-file-not-found-functions)
	      (insert "\n***** File " filename " not found! *****\n\n")))))))