duplicate-thing icon indicating copy to clipboard operation
duplicate-thing copied to clipboard

Idea: duplicate-thing-to-other-window

Open kwstat opened this issue 3 years ago • 0 comments

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"))))

kwstat avatar Jul 30 '21 16:07 kwstat