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
How to Use an Older Version of Gcc in Linux
Command Not Found in Bash's If-Else Condition When Using [! -D "$Dir"]
Linux: Modpost Does Not Build Anything
Is There a Special Restriction on Commands Executed by Cron
Where Does Pp (Par) Unpack Add (-A) Files
New Scala Worksheets Not Evaluated in Eclipse
How to Get Details of All Modules/Drivers That Were Initialized/Probed During the Linux Kernel Boot
How to Do 'Ret' Instruction from Code at _Start in MACos? Linux
How to Run a Shell Script by Cron Job
Bash Script to Find and Display Oldest File
Opening a .Tar.Gz File with a Single Command
How to Stop a Running R Command in Linux Other Than with Ctrl + C
How to Force Linking with a Static Library When a Shared Library of Same Name Is Present
How to Find the Processor/Chip Architecture on Linux