Is there any way to insert text into a buffer that isn't the active buffer with Elisp?

Perhaps there is an equivalent to with-temp-buffer that takes a specific, existing buffer as an argument?

1 Answer 1


Perhaps something like:

(with-current-buffer "*scratch*" (insert "Test"))

is what you want.

  • Of course! Don't know why I forgot that. Thank you.
    – JCC
    Commented Aug 24, 2016 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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