我在屏幕虚拟终端的一个缓冲区中有代码,我希望将其转移到虚拟终端中的另一个缓冲区。我怎么做?我试过杀死代码,但似乎每个虚拟终端都有自己的杀死环,我杀死的代码没有被拉入另一个虚拟终端。
答案 0 :(得分:2)
似乎@Ehvince提到的剪贴板变量(在使用GUI emacs时有用BTW)在终端中没用。描述了一种解决方法here。我在下面的文章中添加代码,以避免死链接
(unless window-system
(when (getenv "DISPLAY")
;; Callback for when user cuts
(defun xsel-cut-function (text &optional push)
;; Insert text to temp-buffer, and "send" content to xsel stdin
(with-temp-buffer
(insert text)
;; I prefer using the "clipboard" selection (the one the
;; typically is used by c-c/c-v) before the primary selection
;; (that uses mouse-select/middle-button-click)
(call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))
;; Call back for when user pastes
(defun xsel-paste-function()
;; Find out what is current selection by xsel. If it is different
;; from the top of the kill-ring (car kill-ring), then return
;; it. Else, nil is returned, so whatever is in the top of the
;; kill-ring will be used.
(let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))
(unless (string= (car kill-ring) xsel-output)
xsel-output )))
;; Attach callbacks to hooks
(setq interprogram-cut-function 'xsel-cut-function)
(setq interprogram-paste-function 'xsel-paste-function)))
添加此初始化文件。您需要安装外部程序xsel
才能实现此目的。
答案 1 :(得分:0)
你可以使用emacs守护进程。使用emacs --daemon
启动它,然后在screen
启动emacs作为emacsclient
的客户端(可能包含-nw
或-t
,具体取决于您的需求)。这对我有用。
希望有所帮助:)
答案 2 :(得分:0)
我有这段代码可以帮助我在emacs之外的应用程序之间进行查杀。你可以尝试(但我没有在你的环境中测试)。
(setq x-select-enable-clipboard t ;; copy-paste should work ...
interprogram-paste-function ;; ...with...
'x-cut-buffer-or-selection-value) ;; ...other X clients