4

I'm having an issue with formatting in that when I'm in emacs, the formatting looks fine:

enter image description here

but when the file is viewed with a different text editor, the spaces are different.

enter image description here

this only occurs in the let: form that I've defined. all the other forms seems to work okay.

Is there anything I'm missing? My emacs config is here: https://github.com/zcaudate/etude. It looks different there from the previous two examples.

1

1 Answer 1

4

Could it be that you have TAB characters in your indentation (whitespace)? What happens if you use C-u M-x untabify on your existing code? That changes all TAB chars to an appropriate number of SPC chars.

To prevent Emacs from using TAB chars for indentation, you can put this in your init file:

(setq-default indent-tabs-mode  nil)

You can check whether a given whitespace character is a TAB char by putting your cursor just before it and doing C-x =. That tells you what the character is at point.

2
  • yes it worked. thanks for that. what's the difference between setq-default and setq?
    – zcaudate
    Commented Sep 25, 2018 at 17:19
  • C-h f setq-default, C-h f setq. The former sets the default value for all buffers. Individual buffers can have buffer-local values of a variable.
    – Drew
    Commented Sep 25, 2018 at 17:46

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.