From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?GB2312?B?y/jXodfT?= Newsgroups: gmane.emacs.help Subject: copy and paste Date: Tue, 6 Jan 2009 21:35:34 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1231306839 6067 80.91.229.12 (7 Jan 2009 05:40:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2009 05:40:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 07 06:41:50 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LKRAr-00015N-Ss for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Jan 2009 06:41:50 +0100 Original-Received: from localhost ([127.0.0.1]:40377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKR9c-00043M-8g for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Jan 2009 00:40:32 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!z6g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-NNTP-Posting-Host: 61.51.238.87 Original-X-Trace: posting.google.com 1231306534 20634 127.0.0.1 (7 Jan 2009 05:35:34 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 7 Jan 2009 05:35:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z6g2000pre.googlegroups.com; posting-host=61.51.238.87; posting-account=VidhwQoAAAClDZCDm61050TEZVFYPse- User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165814 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61148 I found the functions below online somewhere, for easing the process of copying and pasting between emacs and Mac OSX's clipboard. It works, but doesn't seem to be encoding aware -- if I kill from a unicode-encoded buffer and paste into a different osx application (eg Mail), non-ASCII characters come out garbled. My language environment is set to UTF-8, is there something I can add in the functions below that will specify string encoding? I'm trying to achieve all Unicode, all the time. Thanks! Eric (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)