(defun add-auto-mode-re (re mode) (assq-delete-all re auto-mode-alist) (setq auto-mode-alist (cons (cons re mode) auto-mode-alist))) (add-auto-mode-re "\\.sx.\\'" 'archive-mode) (defun jk-xml-prettify () "Put each tag on a separate line and indent." (interactive) (save-excursion (while (search-forward "><" nil t) (replace-match "> <" nil t)) (indent-region (point-min) (point-max) nil))) (defun jk-xml-zip-hook () (let ((suffixes '("\\.xml\\'"))) (while (and suffixes (not (string-match (car suffixes) buffer-file-name))) (setq suffixes (cdr suffixes))) (if suffixes (jk-xml-prettify)))) (add-hook 'archive-extract-hooks 'jk-xml-zip-hook)