The find-file-noselect function uses the
create-file-buffer and after-find-file functions as
subroutines. Sometimes it is useful to call them directly.
This function creates a suitably named buffer for visiting filename, and returns it. It uses filename (sans directory) as the name if that name is free; otherwise, it appends a string such as ‘<2>’ to get an unused name. See also Creating Buffers.
Please note:
create-file-bufferdoes not associate the new buffer with a file and does not select the buffer. It also does not use the default major mode.(create-file-buffer "foo") ⇒ #<buffer foo> (create-file-buffer "foo") ⇒ #<buffer foo<2>> (create-file-buffer "foo") ⇒ #<buffer foo<3>>This function is used by
find-file-noselect. It usesgenerate-new-buffer(see Creating Buffers).
This function sets the buffer major mode, and parses local variables (see Auto Major Mode). It is called by
find-file-noselectand by the default revert function (see Reverting).If reading the file got an error because the file does not exist, but its directory does exist, the caller should pass a non-
nilvalue for error. In that case,after-find-fileissues a warning: ‘(New File)’. For more serious errors, the caller should usually not callafter-find-file.If warn is non-
nil, then this function issues a warning if an auto-save file exists and is more recent than the visited file.If noauto is non-
nil, then this function does not turn on auto-save mode; otherwise, it does.The last thing
after-find-filedoes is call all the functions infind-file-hooks.