read-from-minibuffer
is a great way to prompt a user for a single line of text. How do I prompt a user for a large block of multi-line text in elisp?
This is what I'm thinking, but I don't know if it's the smoothest approach:
- create a temporary buffer (via
with-temporary-buffer
?) - seed the buffer with some default text
- display the buffer
- tell the user, "edit the text as you see fit, then hit <some key sequence> to indicate that you are done" (perhaps via
header-line-format
) - wait for the user to hit the key sequence
- collect the buffer text and put it in a variable (via
buffer-string
) - destroy the temporary buffer and restore the window layout as it was before
- do stuff with the text