如何从OSX上的剪贴板粘贴到Emacs? [英] How to paste to Emacs from clipboard on OSX?

查看:53
本文介绍了如何从OSX上的剪贴板粘贴到Emacs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能非常简单,但是我正在使用Emacs(22.1.1),并且无法使用 Control - Y .

This might be extraordinarily simple, but I am playing with Emacs (22.1.1) and I can't get it to paste text in the clipboard using Control-Y.

推荐答案

如果您正在使用内置的Emacs,那么您将在终端中运行Emacs.剪贴板"是窗口系统的功能.终端模式( -nw )中的Emacs无法访问任何窗口系统特定的API.大多数设计用于终端的命令行工具都是如此.

If you're using the in-built Emacs, then you're running Emacs in the terminal. The "clipboard" is a function of your windowing system. Emacs in terminal mode (-nw) does not access any windowing system specific APIs. This is true of most command line tools designed to work in the terminal.

您需要按照其他人的建议升级Emacs,并以图形方式运行模式.在Mac OS X上使用Emacs 24,所需的行为是默认行为.

You need to upgrade your Emacs as others have suggested, and run in graphical mode. Using Emacs 24 on Mac OS X, the behaviour you want is the default.

如果您要在终端中执行此操作,请

If you want to do this in a terminal, then this hack will make the clipboard work.

(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))

(defun paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))

(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx) 

这篇关于如何从OSX上的剪贴板粘贴到Emacs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆