I have a function that opens a buffer in order to extract some information from it, then switches back to the original buffer and inserts some text:
(save-excursion
(find-file ThisFile)
(setq results some-function))
(insert results)
The brief flash when emacs switches to the new buffer is disconcerting. Is it possible to suppress the buffer -- I guess, keep it at the bottom of the buffer stack?
find-file-noselect
gnu.org/software/emacs/manual/html_node/eintr/Find-a-File.htmlwith-temp-buffer
gnu.org/software/emacs/manual/html_node/elisp/… andinsert-file-contents
gnu.org/software/emacs/manual/html_node/elisp/…find-file-noselect
in the first comment, a common usage is in conjunction with the macrowith-current-buffer
-- but then the buffer either says around or needs to be killed.insert-file-contents
won't automatically enable a major-mode, whereasfind-file-noselect
may trigger a major-mode. It just depends upon personal preference and the result desired.