[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Emacs (in terminal): keeping clipboard synchronized with the system glob
Emacs (in terminal): keeping clipboard synchronized with the system global one?
Fri, 6 Mar 2009 13:33:52 +0100
Good day all,
When running emacs in a terminal, I have problems synchronizing the
emacs-clipboard with the system clipboard (or the "primary selection",
it doesn't really matter)
When using a regular x-window for emacs, the following works well:
(global-set-key "\C-w" 'clipboard-kill-region)
(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-y" 'clipboard-yank)
*But* this has no effect when running emacs within a *terminal*.
Instead, one could use an external tool, "xsel" for keeping the
buffers synchronized. This works well:
(defun copy-to-x-clipboard ()
(call-process-region (region-beginning) (region-end) "xsel" nil 0
nil "-p" "-i")))
(global-set-key "\M-w" 'copy-to-x-clipboard)
Now, I would like to refine this so that M-w is bound to
"copy-to-x-clipboard" whenever emacs is run within a terminal, and
bound to 'clipboard-kill-ring-save when emacs is running within a
normal x-window... or something like that.
Any suggestions? How do you people resolve this?
I am using Ubuntu GNU/Linux 8.10 with
$ emacs-snapshot --version
GNU Emacs 220.127.116.11
- Emacs (in terminal): keeping clipboard synchronized with the system global one?,
Hugo Heden <=