find-file is an interactive and byte-compiled function defined in
files.el.gz.
Signature
(find-file FILENAME &optional WILDCARDS)
Documentation
Edit file FILENAME.
Switch to a buffer visiting file FILENAME, creating one if none
already exists.
Interactively, the default if you just type RET is the current directory,
but the visited file name is available through the minibuffer history:
type M-n to pull it into the minibuffer.
The first time M-n is used after Emacs prompts for the file name,
the result is affected by file-name-at-point-functions, which by
default try to guess the file name by looking at point in the current
buffer. Customize the value of file-name-at-point-functions or set
it to nil, if you want only the visited file name and the current
directory to be available on first M-n request.
You can visit files on remote machines by specifying something
like /ssh:SOME_REMOTE_MACHINE:FILE for the file name. You can
also visit local files as a different user by specifying
/sudo::FILE for the file name.
See the Info node (tramp)File name Syntax in the Tramp Info
manual, for more about this.
Interactively, or if WILDCARDS is non-nil in a call from Lisp,
expand wildcards (if any) and visit multiple files. You can
suppress wildcard expansion by setting find-file-wildcards to nil.
To visit a file without any kind of conversion and without
automatically choosing a major mode, use M-x find-file-literally.
View in manual
Key Bindings
ctl-x-map C-f
global-map <open>
global-map C-x C-f
oo-find-map o
oo-leader-map f o
override-global-map <insert-state> M-SPC f o
override-global-map <motion-state> SPC f o
override-global-map <normal-state> SPC f o
override-global-map <visual-state> SPC f o
override-global-map C-c SPC f o
override-global-map C-c l f o
term-raw-map C-c C-f
References
References in files.el.gz:
(defun find-file-existing ...)
(defun find-file-read-only ...)
(defun find-sibling-file ...)
Find all references Functions used by find-file
Debugging
Enable edebug Enable tracing
Disassemble Forget
Source Code
/usr/share/emacs/29.4/lisp/files.el.gz
(defun find-file (filename &optional wildcards)
"Edit file FILENAME.
\\<minibuffer-local-map>Switch to a buffer visiting file FILENAME, creating one if none
already exists.
Interactively, the default if you just type RET is the current directory,
but the visited file name is available through the minibuffer history:
type \\[next-history-element] to pull it into the minibuffer.
The first time \\[next-history-element] is used after Emacs prompts for the file name,
the result is affected by `file-name-at-point-functions', which by
default try to guess the file name by looking at point in the current
buffer. Customize the value of `file-name-at-point-functions' or set
it to nil, if you want only the visited file name and the current
directory to be available on first \\[next-history-element] request.
You can visit files on remote machines by specifying something
like /ssh:SOME_REMOTE_MACHINE:FILE for the file name. You can
also visit local files as a different user by specifying
/sudo::FILE for the file name.
See the Info node `(tramp)File name Syntax' in the Tramp Info
manual, for more about this.
Interactively, or if WILDCARDS is non-nil in a call from Lisp,
expand wildcards (if any) and visit multiple files. You can
suppress wildcard expansion by setting `find-file-wildcards' to nil.
\\<global-map>To visit a file without any kind of conversion and without
automatically choosing a major mode, use \\[find-file-literally]."
(interactive
(find-file-read-args "Find file: "
(confirm-nonexistent-file-or-buffer)))
(let ((value (find-file-noselect filename nil nil wildcards)))
(if (listp value)
(mapcar 'pop-to-buffer-same-window (nreverse value))
(pop-to-buffer-same-window value))))
Symbol Properties
custom-group
((directory-abbrev-alist custom-variable)
(find-file-existing-other-name custom-variable)
(find-file-visit-truename custom-variable)
(revert-without-query custom-variable)
(find-file-run-dired custom-variable)
(find-directory-functions custom-variable)
(file-name-at-point-functions custom-variable)
(find-file-hook custom-variable)
(enable-local-variables custom-variable)
(enable-local-eval custom-variable)
(confirm-nonexistent-file-or-buffer custom-variable)
(large-file-warning-threshold custom-variable)
(out-of-memory-warning-percentage custom-variable)
(query-about-changed-file custom-variable)
(major-mode-remap-alist custom-variable)
(safe-local-variable-values custom-variable)
(ignored-local-variable-values custom-variable)
(safe-local-eval-forms custom-variable)
(enable-remote-dir-locals custom-variable)
(revert-buffer-quick-short-answers custom-variable)
(find-sibling-rules custom-variable))
custom-loads
(find-file)
event-symbol-element-mask
(find-file 0)
event-symbol-elements
(find-file)
group-documentation
"Finding files."
modifier-cache
((0 . find-file))