When i'm trying to paste some code from browser to Emacs, it will indent code automatically, is there any way to stop Emacs from indenting temporarily like :set paste in vim?
When pasting text through a terminal emulator, the auto-indent feature may destroy the indentation of the pasted text. And if you want to paste as is from the clipboard. Just press F3 in insert mode, and paste. Press F3 again to exit from the paste mode.
The easiest way with emacs24 is:
M-x electric-indent-mode RET
That disables auto indentation.
Paste your thing.
renable
M-x electric-indent-mode RET
Or just M-x UP-Arrow
;-)
Switch into the *scratch*
buffer (or just to some nonexistent buffer; it will be in Fundamental mode, which shouldn't do any autoindentation unless you have somehow configured it to do so), type C-SPC
to start the region, paste your text, type C-w
to cut it within Emacs, switch back to your original buffer, type C-y
to paste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With