#pragma section-numbers off [[TableOfContents]] = 概要 = nxml-mode もしくは nXML mode 。 新しいXML用モード。Emacs21以上でないと動作しない。Mule-UCSとは同時に利用できない。 http://www.xmlhack.com/read.php?item=2061 このメモ20030929のバージョンの記述が主です。最新に追随していません。 = URL = http://www.thaiopensource.com/download/ http://groups.yahoo.com/group/emacs-nxml-mode/ = インストール = nxml-mode-yyyymmdd.tar.gzを取得します。 {{{ tar xvfz nxml-mode-yyyymmdd.tar.gz cd nxml-mode-yyyymmdd make }}} load-pathの通ったディレクトリに移動するか、load-pathを設定してください。 = 設定 = READMEに記述があるので、そのままです。 {{{ (load "~/lib/lisp/nxml-mode-200YMMDD/rng-auto.el") (setq auto-mode-alist (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) auto-mode-alist)) }}} {{{ M-x customize-group nxml }}} にて設定してください。 == 色 == 色の設定がいろいろと可能です。 {{{ nxml-xml-declaration-delimiter-face (for the ) nxml-xml-declaration-xml-face (for the xml keyword) nxml-xml-declaration-attribute-name-face (for encoding, version etc) nxml-xml-declaration-attribute-value-delimiter-face (for the "") nxml-xml-declaration-attribute-value-face (for the contents of "") }}} ちなみに以下の設定をするとXMLhackでの紹介画像とほぼ同じになります。 {{{ (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(mode-line ((((type x w32 mac) (class color)) (:background "navy" :foreground "yellow" :box (:line-width -1 :style released-button))))) '(nxml-comment-content-face ((t (:foreground "yellow4")))) '(nxml-comment-delimiter-face ((t (:foreground "yellow4")))) '(nxml-delimited-data-face ((t (:foreground "lime green")))) '(nxml-delimiter-face ((t (:foreground "grey")))) '(nxml-element-local-name-face ((t (:inherit nxml-name-face :foreground "medium turquoise")))) '(nxml-name-face ((t (:foreground "rosy brown")))) '(nxml-tag-slash-face ((t (:inherit nxml-name-face :foreground "grey"))))) }}} = 利用方法 = 説明は {{{ C-u M-x info RET nxml-mode.info RET }}} で読むのがよいです。 C-c s schemaname.rnc にてschemaをロードする。 C- にてどんどんタグ記述。 C-c i で終了タグを記述。 C-c f でタグ閉じる。 終了って感じです。 = schemaの指定 = その場のみなら {{{ C-c s schemaname.rnc }}} でもよいですが、これは普通に使うには面倒です。 {{{ M-x customize-variable rng-auto-file-name-alist もしくは M-x customize-variable rng-auto-element-alist }}} でカスタマイズしていまうのが簡易です。 最新版では変更になっていて rng-schema-locating-files にて schemas.xml を指定する事で設定ができます。 == rng-auto-file-name-alist == これはファイル名で指定します。 デフォルトでは {{{ (".*\\.xsl\\'" . "${nxml-home}/schema/xslt.rnc") (".*\\.x?html?\\'" . "${nxml-home}/schema/xhtml.rnc") (".*\\.rng\\'" . "${nxml-home}/schema/relaxng.rnc") (".*\\.rdf\\'" . "${nxml-home}/schema/rdfxml.rnc") ${nxml-home}はnxmlのディレクトリ }}} みたいな設定になっています。 こまかい事はrng-auto.elを見るとわかるかと思います。 手で追加するなら {{{ (setq rng-auto-file-name-alist (append (list '(".*\\.xslt\\'" "~/lib/lisp/nxml-mode/schema/xslt.rnc") ) rng-auto-file-name-alist-default) ) }}} とかで可能です。 == rng-auto-element-alist == これはエレメントの指定で設定します。 = 参考サイト = ["RelaxNG"] http://kimama.ddo.jp/programming/nxml-mode/ http://www.dpawson.co.uk/relaxng/nxml/ [http://www.emacswiki.org/cgi-bin/wiki/NxmlMode EmacsWiki: NxmlMode] [http://ourcomments.org/Emacs/DL/elisp/ Directory /Emacs/DL/elisp/] ---- CategoryPrograming CategoryEmacs CategoryXml