Emacs xml mode indent with tabs -


i desperately try make emacs xml (sgml?) mode indent tabs instead of spaces. tried far:

(defun my-xml-hook ()   (setq c-tab-always-indent t         tab-width 4         indent-tabs-mode t) ; use tabs indentation   (setq indent-line-function 'insert-tab) ) (add-hook 'xml-mode-hook 'my-xml-hook) (defun local-sgml-mode-hook   (setq fill-column 70         indent-tabs-mode t         next-line-add-newlines nil         sgml-indent-data t)   (auto-fill-mode t)   (setq indent-line-function 'insert-tab)   ) (add-hook 'psgml-mode-hook '(lambda () (local-psgml-mode-hook))) 

nothing works though, indentation still happen 2 spaces (emacs23 , emacs24) when editing *.xml files.

note have

(setq indent-tabs-mode nil) 

in .emacs file, hook should called afterwards should overridden.

how can force emacs indent tabs in *.xml files? why hooks not working?

(c-)tab-always-indent controls hitting tab key does, not inserted.

setting indent-line-function insert-tab make lose smart indentation of mode.

if using modern emacs, chances using nxml-mode instead of xml-mode. in case nxml-mode-hook should 1 should (setq indent-tabs-mode t).

if using default sgml mode, sgml-mode-hook should 1 should (setq indent-tabs-mode t) should done (in snippet using psgml-mode-hook)

(and tab-always-indent , indent-line-function leave in default states)

edit

to summarize conversation below: variable nxml-child-indent should not less tab-width.

(and since default emacs values variables 2 , 8, imho configuring emacs indent xml using tabs in emacs harder should be)


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -