I want to write function that will create new empty buffer, populates it with current
term buffer contents, preserving point and window-start positions, and switch to it right away. Basically I want to make my own
term-line-mode. Function below do it all great, with only problem that its not preserving coloring of term buffer:
(defun sandric/duplicate-current-term-buffer () (interactive) (let ((duplicate-buffer (get-buffer-create "NEWBUF")) (term-point (point)) (term-window-start (window-start)) (term-overlay (make-overlay (point-min) (point-max)))) (copy-to-buffer duplicate-buffer (point-min) (point-max)) (switch-to-buffer duplicate-buffer) (set-window-start (selected-window) term-window-start) (goto-char term-point) (move-overlay term-overlay (point-min) (point-max) duplicate-buffer)))
I know nothing about coloring in emacs, and how its actually works, as I understand, it is done via overlays? So in that code I tried to get current term buffer overlay and copy it to newly created duplicate buffer. But I see no color. Can anyone explain how should I tackle this?