I'd like to cut and paste between X-windows and EMACS in a Linux console (as in
a Ctrl-Alt-F1 console). I put together the following small hack, which seems to
work for my environment. But my question is, surely this has been done before?
But I can't find it. Can anyone point me to a better way?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Display assumed to be :0. This should become defcustom.
(defvar conclip-display)
(setq conclip-display ":0")
(defun conpaste ()
"Insert X-windows selection in console at point"
(interactive)
;; Insert X-windows selection at point in an emacs
;; console. (A real console, as gotten by
;; Ctrl-Alt-F1 etc.)
;; Load in .emacs (or equivalent)
;; (load-library "/whatever path you use/conclip.el")
;; or .elc if byte-compiled. Also maybe define a
;; global key sequence, like C-c C-y perhaps.
;; xsel must be installed. In Ubuntu, sudo apt-get xsel.
(insert
(shell-command-to-string
(concat "xsel -b -o --display " conclip-display)))
)
(defun concopy ()
"Copy from console to X-windows clipboard"
(interactive)
;; Copy the current region to the X-windows clipboard.
;; As above, xclip is required, and this would be best
;; tied to a sequence like C-c C-w.
(shell-command-on-region (point) (mark)
(concat "xsel -b -i --display " conclip-display))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_______________________________________________
gnu-emacs-sources mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources