LoginSignup
44
43

More than 5 years have passed since last update.

emacsでコピーした内容をOSのクリップボードと同期する方法(Mac)

Posted at

.emacsファイルに以下の内容を追記してemacsを再起動するだけ。

(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)

これで、emacsでコピー、カットした内容を他のアプリケーションにペースト出来るようになる。

最高です。

44
43
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
44
43