Skip to main content

Indent in emacs How can I control the indentation inserted by usingEmacs because I used the tab key?

This is probably a really basic question. But, but something I hadn't thought about before. When: When editing code, how to indent.? I think thethe way to go is simply use the tab key and then, once indented once, emacsEmacs can work out that you are on an indented line, and when you do apress return, you get back to the indented locationsame indentation level. And if you tab once more, you are at the 2nd indentsecond indentation level.

On my emacsEmacs the indentation seemslevels seem to be 2two characters each. In my .emacs.emacs file, I see '(tab-width 2) -'(tab-width 2) presumably the reason I get 2 charactertwo-character indents?

If I go to whitespace-modewhitespace-mode, I see there are no tabstab characters even though I did press tab for the indent. In my .emacs.emacs file, I see: (setq-default indent-tabs-mode nil)(setq-default indent-tabs-mode nil).

Does indent-tabs-mode nilindent-tabs-mode being nil change tabs to spaces?

Indent in emacs by using tab?

This is probably a really basic question. But something I hadn't thought about before. When editing code, how to indent. I think the way to go is simply use the tab key and then once indented once, emacs can work out that you are on an indented line and when you do a return you get back to the indented location. And if you tab once more you at the 2nd indent level.

On my emacs the indentation seems to be 2 characters. In my .emacs file I see '(tab-width 2) - presumably the reason I get 2 character indents?

If I go to whitespace-mode I see there are no tabs even though I did tab for the indent. In my .emacs file I see: (setq-default indent-tabs-mode nil)

Does indent-tabs-mode nil change tabs to spaces?

How can I control the indentation inserted by Emacs because I used the tab key?

This is probably a really basic question, but something I hadn't thought about before: When editing code, how to indent? I think the way to go is simply use the tab key and then, once indented once, Emacs can work out that you are on an indented line, and when you press return, you get back to the same indentation level. And if you tab once more, you are at the second indentation level.

On my Emacs the indentation levels seem to be two characters each. In my .emacs file, I see '(tab-width 2) presumably the reason I get two-character indents?

If I go to whitespace-mode, I see there are no tab characters even though I did press tab for the indent. In my .emacs file, I see (setq-default indent-tabs-mode nil).

Does indent-tabs-mode being nil change tabs to spaces?

Became Hot Network Question
edited tags
Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Source Link
arcomber
  • 229
  • 2
  • 8

Indent in emacs by using tab?

This is probably a really basic question. But something I hadn't thought about before. When editing code, how to indent. I think the way to go is simply use the tab key and then once indented once, emacs can work out that you are on an indented line and when you do a return you get back to the indented location. And if you tab once more you at the 2nd indent level.

On my emacs the indentation seems to be 2 characters. In my .emacs file I see '(tab-width 2) - presumably the reason I get 2 character indents?

If I go to whitespace-mode I see there are no tabs even though I did tab for the indent. In my .emacs file I see: (setq-default indent-tabs-mode nil)

Does indent-tabs-mode nil change tabs to spaces?