Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy paste without source font lock in emacs?

When you copy text from one buffer to another (M-w and C-y) it copy text with font-lock and when you paste it it display with colors from the buffer I copied the text. Is it possible to change that to make it display with font from new buffer?

like image 514
jcubic Avatar asked Feb 25 '14 19:02

jcubic


People also ask

How do I copy paste in emacs terminal?

When you copy and paste text, the terminal does it : you're taking the text that the terminal displays and not the text that is in your emacs app. That's why you have to use terminal keybindings : Ctrl-Shift-C and Ctrl-Shift-V to copy and paste text.

How do I copy and paste from outside in Emacs?

An Emacs copy is the command kill-ring-save (usually bound to M-w ). A system copy is what you typically get from pressing C-c (or choosing "Edit->Copy" in a application window). An X copy is "physically" highlighting text with the mouse cursor. An Emacs paste is the command yank (usually bound to C-y ).


1 Answers

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.

like image 77
Drew Avatar answered Oct 10 '22 05:10

Drew