Function: find-file-literally

find-file-literally is an interactive and byte-compiled function defined in files.el.gz.

Signature

(find-file-literally FILENAME)

Documentation

Visit file FILENAME with no conversion of any kind.

Format conversion and character code conversion are both disabled, and multibyte characters are disabled in the resulting buffer. The major mode used is Fundamental mode regardless of the file name, and local variable specifications in the file are ignored. Automatic uncompression and adding a newline at the end of the file due to require-final-newline is also disabled.

If Emacs already has a buffer that is visiting the file, this command asks you whether to visit it literally instead.

In non-interactive use, the value is the buffer where the file is visited literally. If the file was visited in a buffer before this command was invoked, it will reuse the existing buffer, regardless of whether it was created literally or not; however, the contents of that buffer will be the literal text of the file without any conversions.

In a Lisp program, if you want to be sure of accessing a file's contents literally, you should create a temporary buffer and then read the file contents into it using insert-file-contents-literally.

View in manual

Probably introduced at or before Emacs version 20.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun find-file-literally (filename)
  "Visit file FILENAME with no conversion of any kind.
Format conversion and character code conversion are both disabled,
and multibyte characters are disabled in the resulting buffer.
The major mode used is Fundamental mode regardless of the file name,
and local variable specifications in the file are ignored.
Automatic uncompression and adding a newline at the end of the
file due to `require-final-newline' is also disabled.

If Emacs already has a buffer that is visiting the file,
this command asks you whether to visit it literally instead.

In non-interactive use, the value is the buffer where the file is
visited literally.  If the file was visited in a buffer before
this command was invoked, it will reuse the existing buffer,
regardless of whether it was created literally or not; however,
the contents of that buffer will be the literal text of the file
without any conversions.

In a Lisp program, if you want to be sure of accessing a file's
contents literally, you should create a temporary buffer and then read
the file contents into it using `insert-file-contents-literally'."
  (interactive
   (list (read-file-name
          "Find file literally: " nil default-directory
          (confirm-nonexistent-file-or-buffer))))
  (switch-to-buffer (find-file-noselect filename nil t)))