Cooperação com a área de transferência e emacs (janela / sem janela)

1. (quando sistema de janela …)

(setq x-select-enable-clipboard t)

2. (a menos que o sistema de janela …)

2.1 (quando (eq tipo de sistema ‘darwin) …)

(defun my-cut-function (text &optional rest)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))

(defun my-paste-function ()
(shell-command-to-string "pbpaste"))

(setq interprogram-cut-function 'my-cut-function)
(setq interprogram-paste-function '
my-paste-function)

2.2 (quando (tipo de sistema eq ‘gnu / linux) …)

(defun my-cut-function (text &optional rest)
(let ((process-connection-type nil))
(let ((proc (start-process "xclip" "*Messages*" "xclip")))
(process-send-string proc text)
(process-send-eof proc))))

(defun my-paste-function ()
(shell-command-to-string "xclip -o"))

(setq interprogram-cut-function 'my-cut-function)
(setq interprogram-paste-function '
my-paste-function)

2.3 Outro tipo de sistema

Eu não preciso disso