Try the command sgml-pretty-print from sgml-mode. This operates on the region, so you could mark the buffer first:
Or maybe define a command :
(defun my-xml-pretty-print ()
(unless (featurep 'sgml-mode) (require 'sgml-mode))
(sgml-pretty-print (point-min) (point-max)))
Is there a way to get a pretty-printed backtrace buffer?
There is, but you'll have to wait for Emacs 27 to be released or get a build of it in the meantime. Quoth its etc/NEWS file:
* Changes in Specialized Modes and Packages in Emacs 27.1
*** The Lisp Debugger is now based on 'backtrace-mode'.
Backtrace mode adds fontification and commands ...
The following lisp code modifies org-babel-variable-assignments:plantuml.
If you prefix a variable of a plantuml source block with json: newlines escaped with the character ?\\ are not stripped from the value of that variable. Instead the substring "\\\"" is reduced to "\"".
If you want to use the Elisp snippet put it into your init file and restart Emacs.
With help from @wvxvw, the problem wasn't yaml-mode, but my before-save-hooks. That listed prelude-cleanup-maybe as the only entry. Disabling prelude-clean-whitespace-on-save fixed the problem. With help from this question, the code below makes that change every time I open a yaml file:
;; whitespace cleanup can conflict with other people's IDEs, so don't ...