unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: 锁住子 <girzel@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: copy and paste
Date: Tue, 6 Jan 2009 21:35:34 -0800 (PST)	[thread overview]
Message-ID: <c1a34f19-958e-4273-a348-a75c3392e109@z6g2000pre.googlegroups.com> (raw)

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)


             reply	other threads:[~2009-01-07  5:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07  5:35 锁住子 [this message]
     [not found] <mailman.3198.1169037917.2155.help-gnu-emacs@gnu.org>
2007-01-18 12:39 ` copy and paste Martin
2007-01-20 14:50   ` Roger Mason
  -- strict thread matches above, loose matches on Subject: below --
2007-01-17 12:45 Roger Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1a34f19-958e-4273-a348-a75c3392e109@z6g2000pre.googlegroups.com \
    --to=girzel@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).