Function: find-file-noselect-1
find-file-noselect-1 is a byte-compiled function defined in
files.el.gz.
Signature
(find-file-noselect-1 BUF FILENAME NOWARN RAWFILE TRUENAME NUMBER)
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
(let (error)
(with-current-buffer buf
(kill-local-variable 'find-file-literally)
;; Needed in case we are re-visiting the file with a different
;; text representation.
(kill-local-variable 'buffer-file-coding-system)
(kill-local-variable 'cursor-type)
(let ((inhibit-read-only t))
(erase-buffer))
(and (not rawfile)
(set-buffer-multibyte t))
(if rawfile
(condition-case err
(let ((inhibit-read-only t)
(enable-local-variables nil))
(insert-file-contents-literally filename t))
(file-error
(when (file-exists-p filename)
(kill-buffer buf)
(signal 'file-error
(if (file-readable-p filename)
(cdr err)
(list "File is not readable" filename))))
;; Unconditionally set error
(setq error t)))
(condition-case err
(let ((inhibit-read-only t))
(insert-file-contents filename t))
(file-error
(when (file-exists-p filename)
(kill-buffer buf)
(signal 'file-error
(if (file-readable-p filename)
(cdr err)
(list "File is not readable" filename))))
;; Run find-file-not-found-functions until one returns non-nil.
(or (run-hook-with-args-until-success 'find-file-not-found-functions)
;; If they fail too, set error.
(setq error t)))))
;; Record the file's truename, and maybe use that as visited name.
(setq buffer-file-truename
(if (equal filename buffer-file-name)
truename
(abbreviate-file-name (file-truename buffer-file-name))))
(setq buffer-file-number number)
(if find-file-visit-truename
(setq buffer-file-name (expand-file-name buffer-file-truename)))
;; Set buffer's default directory to that of the file.
(setq default-directory (file-name-directory buffer-file-name))
;; Turn off backup files for certain file names. Since
;; this is a permanent local, the major mode won't eliminate it.
(and backup-enable-predicate
(not (funcall backup-enable-predicate buffer-file-name))
(setq-local backup-inhibited t))
(if rawfile
(let ((enable-local-variables nil))
(set-buffer-multibyte nil)
(setq buffer-file-coding-system 'no-conversion)
(set-buffer-major-mode buf)
(setq-local find-file-literally t))
(after-find-file error (not nowarn)))
(current-buffer))))