I want to create a command and a keybind to scan with
tidy a full buffer. The keybinding has to be active only when editing XML files.
~/.emacs.d/init.el file I've added the following lines:
(defun tidy-xml () "Tidies the XML content in the buffer using `tidy'" (interactive) (shell-command-on-region (point-min) (point-max) "tidy -i -w 72 -q -xml" (current-buffer) t "*Error*" t)) (define-key nxml-mode-map "\C-c t" 'tidy-xml)
But when I open Emacs it returns the following warning:
Warning (initialization): An error occurred while loading ‘/home/jim/.emacs.d/init.el’: Symbol's value as variable is void: nxml-mode-map
I'm not able to see where the error is. Can you give me a hand?