[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cut and paste to Linux console

From: chipschap
Subject: Cut and paste to Linux console
Date: Tue, 9 Oct 2012 13:40:23 -0700 (PDT)
User-agent: G2/1.0

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"

;; 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.

     (concat "xsel -b -o --display " conclip-display)))

(defun concopy ()
"Copy from console to X-windows clipboard"

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]