Skip to content
emacs package to reformat xml using xmllint
Emacs Lisp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is an Emacs package to make it easy to reformat XML files using the xmllint utility. xmllint is is part of libxml2, and available from most software repositories, e.g. apt install libxml2-utils on Debian/Ubuntu.


Install the xml-format Melpa package using M-x package-install, or via use-package:

(use-package xml-format
  :demand t
  :after nxml-mode)


Use one of these commands via M-x or bind them to a key:

  • xml-format-on-save-mode

    Automatically reformat the buffer on save.

  • xml-format-buffer

    Reformat the current buffer.

  • xml-format-region

    Reformat the current region.


This package deliberately has minimal configuration. Use M-x customize-group RET xml-format or change these variables in your init.el:

  • xml-format-xmllint-executable
  • xml-format-xmllint-args


BSD-3-clause. Copyright © 2019 wouter bolsterlee.


wouter bolsterlee. wbolster. on github. star my repos. fork them. and so on. on twitter. follow me. or say hi.

You can’t perform that action at this time.