Function: archive-set-buffer-as-visiting-file

archive-set-buffer-as-visiting-file is a byte-compiled function defined in arc-mode.el.gz.

Signature

(archive-set-buffer-as-visiting-file FILENAME)

Documentation

Set the current buffer as if it were visiting FILENAME.

Source Code

;; Defined in /usr/src/emacs/lisp/arc-mode.el.gz
(defun archive-set-buffer-as-visiting-file (filename)
  "Set the current buffer as if it were visiting FILENAME."
  (save-excursion
    (goto-char (point-min))
    (let ((buffer-undo-list t)
	  (coding
	   (or coding-system-for-read
	       (and set-auto-coding-function
		    (save-excursion
		      (funcall set-auto-coding-function
			       filename (- (point-max) (point-min)))))
	       ;; The following let-binding of file-name-handler-alist forces
	       ;; find-file-not-found-set-buffer-file-coding-system to ignore
	       ;; the file's name (see dos-w32.el).
	       (let ((file-name-handler-alist
		      '(("" . archive-file-name-handler))))
		 (car (find-operation-coding-system
		       'insert-file-contents
		       (cons filename (current-buffer)) t))))))
      (unless (or coding-system-for-read
                  enable-multibyte-characters)
        (setq coding
              (coding-system-change-text-conversion coding 'raw-text)))
      (unless (memq coding '(nil no-conversion))
        ;; If CODING specifies a certain EOL conversion, reset that, to
        ;; force 'decode-coding-region' below determine EOL conversion
        ;; from the file's data...
        (if (numberp (coding-system-eol-type coding))
            (setq coding (coding-system-change-eol-conversion coding nil)))
        (decode-coding-region (point-min) (point-max) coding)
        ;; ...then augment CODING with the actual EOL conversion
        ;; determined from the file's data.
        (let ((eol-type (coding-system-eol-type last-coding-system-used)))
          (if (numberp eol-type)
	      (setq last-coding-system-used
                    (coding-system-change-eol-conversion coding eol-type))
            (setq last-coding-system-used coding))))
      (set-buffer-modified-p nil)
      (kill-local-variable 'buffer-file-coding-system)
      (after-insert-file-set-coding (- (point-max) (point-min))))))