diff -r a7bb0608855b -r 9f4456fcac0e .emacs-my --- a/.emacs-my Sat Apr 14 17:15:52 2018 +0300 +++ b/.emacs-my Thu May 03 11:52:34 2018 +0300 @@ -3502,6 +3502,17 @@ (my--eval-after-load nxml-mode (define-key nxml-mode-map [C-return] 'nxml-complete)) +(defun my-nxml-pp () + "Pretty-print XML." + (interactive) + (goto-char (point-min)) + (while (re-search-forward ">[ \t\n\r]+<" nil t) + (replace-match ">\n<")) + (while (re-search-forward "><" nil t) + (replace-match ">\n<")) + (indent-region (point-min) (point-max)) + (goto-char (point-min))) + (defun my-nxml-where (&optional prefix) "Display the hierarchy of XML elements the point is on as a path." (interactive "P")