Emacs personal configuration
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

37 linhas
1.3KB

  1. (add-auto-mode
  2. 'nxml-mode
  3. (concat "\\."
  4. (regexp-opt
  5. '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
  6. "gpx" "tcx" "plist"))
  7. "\\'"))
  8. (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
  9. (fset 'xml-mode 'nxml-mode)
  10. (add-hook 'nxml-mode-hook (lambda ()
  11. (set (make-local-variable 'ido-use-filename-at-point) nil)))
  12. (setq nxml-slash-auto-complete-flag t)
  13. ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
  14. (defun sanityinc/pp-xml-region (begin end)
  15. "Pretty format XML markup in region. The function inserts
  16. linebreaks to separate tags that have nothing but whitespace
  17. between them. It then indents the markup by using nxml's
  18. indentation rules."
  19. (interactive "r")
  20. (save-excursion
  21. (nxml-mode)
  22. (goto-char begin)
  23. (while (search-forward-regexp "\>[ \\t]*\<" nil t)
  24. (backward-char) (insert "\n"))
  25. (indent-region begin end)))
  26. ;;----------------------------------------------------------------------------
  27. ;; Integration with tidy for html + xml
  28. ;;----------------------------------------------------------------------------
  29. (require-package 'tidy)
  30. (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
  31. (provide 'init-nxml)