1

I have a use-package idle hook that loads my org files into buffers for future use. I want this to be unobtrusive. However, I cannot find any find-file function which loads a file without changing the display.

There are a number of find-file functions in the Emacs manual, but none of these do what I want.

find-file Visit a file.

find-file-read-only Visit a file for viewing, without allowing changes to it.

find-alternate-file Visit a different file instead of the one visited last.

find-file-other-window Visit a file, in another window.

find-file-other-frame Visit a file, in a new frame.

find-file-literally Visit a file with no conversion of the contents.

I thought find-file-literally might be a winner, but it does in fact load the file into the current window.

Is there a function I can use to load files into buffers without any display changes?

2

The function you want is find-file-noselect.

This function is the guts of all the file-visiting functions. It returns a buffer visiting the file filename. You may make the buffer current or display it in a window if you wish, but this function does not do so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.