0

all

I set my file indent policy in .emacs as following,

;; indent code settings
(setq-default indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)

but it doesn't work for xml file, when I using 'C+M+\' to format xml file, the child node only indent 2 space than parent. I want to child node is 4 space indent than parent. I add below settings, this works as what I want.

(custom-set-variables
 '(nxml-outline-child-indent 4))

Why does first setting not work? and, another problem, is there a consistent way to do that for all code file?

thanks for your help.

Drew
  • 29,895
  • 7
  • 74
  • 104
gladman
  • 1,208
  • 4
  • 19
  • 39

1 Answers1

1

The amount of an indent-step is set by a variable with -offset in it's name.

As several xml-modes are around, check the major-mode for such, here its sgml-basic-offset with value 2 - which would need 4.

Also indent-tabs-mode must be t, if TAB character shall be used to fill the indent.

Andreas Röhler
  • 4,804
  • 14
  • 18