duplicate-thing
duplicate-thing copied to clipboard
Idea: duplicate-thing-to-other-window
When I work with R script/shell windows, I often want to choose a region of the shell output and copy it back to the script. Here's an idea of how that might work. I would like to have the option of commenting the pasted region when it is copied to my R script. I think this function might be nice in the duplicate-thing package.
;; https://emacs.stackexchange.com/questions/47200/copy-paste-text-among-split-window-buffers
(defun copy-region-to-next-window (b e)
"Copy text in the region to next window."
(interactive "r")
(pcase (window-list)
(`(,w0 ,w1)
(with-selected-window w1
(insert-buffer-substring (window-buffer w0) b e)))
(t (user-error "Only works with 2 windows"))))