I am looking for a way to insert a formatted text into a specific buffer (not the active buffer).

As it seems to me, the only way to do so is to use a snippet as shown below:

(insert (propertize (format-time-string "%H:%M:%S")
                    '(:height 4.0 :inverse-video t)))

The above inserts it into the active/current buffer.

There are ways to insert strings to a specific buffer but then they do not support formatting.

I am starting to wonder if what I intend to do is even possible...

  • 3
    Try using the with-current-buffer macro.
    – user12563
    Commented Sep 7, 2017 at 16:44
  • Looks like what I need, I'll give it a try.
    – myTerminal
    Commented Sep 7, 2017 at 16:52

1 Answer 1


An example of what you are trying to do is contained in the manual. You need either with-current-buffer or save-current-buffer:

(with-current-buffer destination-buffer
  (insert (propertize (format-time-string "%H:%M:%S")
                      'face '(:height 4.0 :inverse-video t))))

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.