5

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")
                    'face
                    '(: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...

Drew
  • 75,699
  • 9
  • 109
  • 225
myTerminal
  • 417
  • 1
  • 5
  • 15

1 Answers1

9

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))))
sds
  • 5,928
  • 20
  • 39