Reputation: 457
I'd like to implement a function to show a file I want in a specific window and I also would like to change the file to an another one in that window in case I want to. But I couldn't find any appropriate API. Could you give me some advices to write this sort of functions, please? I can get an window id from (split-window-xxx) but I can't imagine what elisp API can have it displayed the file I want to. Please give me some advice.
Upvotes: 1
Views: 66
Reputation: 28531
The lower-level control you might be looking for are find-file-noselect
which opens a file and returns the buffer without displaying it, and set-window-buffer
which lets you change the buffer displayed by a particular window.
Upvotes: 1
Reputation: 83
You can try
(with-selected-window window
(find-file f))
or if you want to load a buffer
(with-selected-window window
(switch-to-buffer buf))
Upvotes: 2