1 Star 0 Fork 2

zhengchen/emacs

forked from latpaw/emacs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
init-nxml.el 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
chen bin 提交于 2013-04-10 17:16 . enable nxml-mode for jsp and tag
(load-library "rng-auto")
(add-to-list 'auto-mode-alist
(cons (concat "\\." (regexp-opt '("cshtml"
"aspx"
"xml"
"xsd"
"sch"
"rng"
"xslt"
"svg"
"rss"
"bkl"
"bkgen"
"tpl"
"tmpl"
"tag"
"jsp"
"inc") t) "\\'")
'nxml-mode))
(setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
(fset 'html-mode 'nxml-mode)
(fset 'xml-mode 'nxml-mode)
(add-hook 'nxml-mode-hook
(lambda ()
(set (make-local-variable 'ido-use-filename-at-point) nil)
(require 'tagedit)
(tagedit-add-paredit-like-keybindings)
(local-set-key (kbd "C-M-n") 'nxml-forward-element)
(local-set-key (kbd "C-M-p") 'nxml-backward-element)
))
(setq nxml-slash-auto-complete-flag t)
;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
(defun pp-xml-region (begin end)
"Pretty format XML markup in region. The function inserts
linebreaks to separate tags that have nothing but whitespace
between them. It then indents the markup by using nxml's
indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region begin end)))
;;----------------------------------------------------------------------------
;; Integration with tidy for html + xml
;;----------------------------------------------------------------------------
(add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
(add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
(provide 'init-nxml)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cowboy13/emacs.git
git@gitee.com:cowboy13/emacs.git
cowboy13
emacs
emacs
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385