I set up my emacs to use sgml-mode so that I can format xml with M-x reformat-xml, but it puts the closing tags on the line below, rather than on the same line.

instead of this:


I want this:


Can I configure sgml-mode to do this for all reformats?

So far I've just got this to activate sgml-mode:

(require 'sgml-mode)

(defun reformat-xml ()
    (sgml-pretty-print (point-min) (point-max))
    (indent-region (point-min) (point-max))))


Your Answer

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

Browse other questions tagged or ask your own question.