I have a system that I am not allowed permissions to install software but need to copy text from the remote server to the host computer's system clipboard. Because I can't install xclip or xsel and I am using emacs with tmux, the formatting of text gets all screwed up because of the newlines that tmux introduces. I thought of the possibility of writing regions to a file that I can remotely open the file and manually copy the properly formatted text.
I've created my own keyboard defined macro using write-regions that worked during a current open session of emacs but would have problems upon reopening. Error along the lines of command terminated by ringing the bell.
I've also used the following answer's code but the OP wanted to interactively set the file but in my case the file is known already so there is no need for me to set it each time I use the function.
Is there a way for me to write this function such that the a region automatically writes to ~/copybuffer.txt
and doesn't delete the region afterwards. See original QA here and my code edits.
Unfortunately, in my code I see variable is void: start. I clearly don't understand something about defining lisp functions.
(defun copybuffer
"function takes current region, and writes it to specified file"
(write-region region-beginning region-end '~/copybuffer.txt' t)))