Emacs personal configuration
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

30 lines
1005B

  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. (provide 'init-nxml)