Integrate Emacs Copy/Paste with System Copy/Paste

Cua-copy/paste and System clipboard in emacs

I don't know enough about Emacs to offer any insights, but I can share what works for me (on Ubuntu) since i also have copy/paste bound to C-c/C-v with this in my ~/.emacs:

(cua-mode t)

And per this post: Integrate Emacs copy/paste with System copy/paste I have copying and pasting to/from Emacs without the problem you describe with these lines in ~/.emacs:

(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

I see you already tried the two lines above, but did you try them alone without the other lines which might be conflicting with them?

Integrate Emacs copy/paste with System copy/paste

This works on my machine:

;; CUA OS copypasta even in ncurses mode
(case system-type
('darwin (unless window-system
(setq interprogram-cut-function
(lambda (text &optional push)
(let* ((process-connection-type nil)
(pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy")))
(process-send-string pbproxy text)
(process-send-eof pbproxy))))))
('gnu/linux (progn
(setq x-select-enable-clipboard t)
(defun xsel-cut-function (text &optional push)
(with-temp-buffer
(insert text)
(call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))
(defun xsel-paste-function()

(let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))
(unless (string= (car kill-ring) xsel-output)
xsel-output )))
(setq interprogram-cut-function 'xsel-cut-function)
(setq interprogram-paste-function 'xsel-paste-function))))

How to copy text to system clipboard in emacs while working in terminal buffer?

This article (http://blog.binchen.org/posts/copypaste-in-emacs.html) helps me. In it, the author implement a function to fulfil such a task.

Copy full file path into Copy-Paste-Clipboard

The code mentioned in my question works, it was a problem with my configuration of .emacs-file, because I didn't restart Emacs properly.

Therefore use:

(defun clip-file ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
(file-name-directory default-directory)
(buffer-file-name))))
(when filename
(x-select-text filename))))

Emacs: paste from previous copies

Use M-y (yank-pop) immediately after C-y (yank) to cycle through your kill ring.

So, to paste the first text out of three do C-y M-y M-y.

See earlier kills in the Emacs manual for details on how this works.

How to copy paste without source font lock in emacs?

See the doc for user options yank-excluded-properties and yank-handled-properties. And start with the doc for yank: C-h f yank. It tells you:

When this command inserts text into the buffer, it honors the
`yank-handled-properties' and `yank-excluded-properties'
variables, and the `yank-handler' text property. See
`insert-for-yank-1' for details.

IOW, just tell yank not to paste properties such as face and font-lock-face.

See also the Elisp manual, node Yanking.



Related Topics



Leave a reply



Submit