When you set Emacs to recognize 4 spaces as 1 tab, then copy text from an Emacs buffer to another program, will the other program see 4 spaces or interpret it as 1 tab (which may correspond to a different number of spaces, depending on setup)?

1 Answer 1


This depends on how you have configured Emacs, which is not clear to me from the question.

Your buffer text might contain spaces or tab characters, depending on your settings. Copying and pasting the text won't change the actual characters. If you copy text containing a tab control character it will be pasted as a tab (\t) and the way it is displayed will depend on the editor.

See Indentation (in the Emacs manual) for more detail. The setting indent-tabs-mode controls whether Emacs inserts tab or space characters when you indent. By default it is set to insert tab characters.

You can also use the commands tabify and untabify to convert spaces to tabs (or vice versa).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.