问题描述
这可能非常简单,但是我正在使用Emacs(22.1.1),并且无法使用--.
推荐答案
如果您正在使用内置的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 graphicalmode. Using Emacs 24 on Mac OS X, the behaviour you want is the default.
如果您要在终端中执行此操作,请此 hack将使剪贴板正常工作.
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!