YaTeX の作者の広瀬さんが作られた html 編集用のモードです。yatex の配布にも含まれていますが、yahtml だけでも配布されています。
html ファイルを記述する際に使われるものには他に html-helper-mode というものがあります。 私は野鳥を使う感覚で使えるため、yahtml の方を使っています。 こちらの方がより賢い便宜を提供してくれるように思いますし。 このページも勿論これを使いながら書いてます。
(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) (setq auto-mode-alist (cons (cons "\\.html?$" 'yahtml-mode) auto-mode-alist)) ;; 表示には w3m (defadvice yahtml-browse-html (around w3m-yahtml-browse-html activate compile) (w3-fetch (ad-get-arg 0)) ; (w3m-goto-url (ad-get-arg 0) t) ) (setq yahtml-lint-program "htmllint") (setq yahtml-kanji-code 2) ; (1 sjis, 2 jis, 3 euc) (setq yahtml-path-url-alist '( ("~/public_html" . "http://www.math.s.chiba-u.ac.jp/~matsu") )) (add-hook 'yahtml-mode-hook (function (lambda () (progn (require 'yahtml-insert-index) (auto-fill-mode 0) (if (equal 'shift_jis-unix buffer-file-coding-system) (progn (set-buffer-file-coding-system 'shift_jis-dos) (set-buffer-modified-p nil))) )))) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) ;;; yahtml 用の設定 (setq yahtml-www-browser "mosaic"); yatex の html モードで起動するビューワ (setq yahtml-path-url-alist ; ホームページの連想リスト '(("~/public_html/index-j.html" . "http://www.math.s.chiba-u.ac.jp/~matsu/public_html/index.html"))) ;; html ファイルを編集する際の自動折り返し桁数 (add-hook 'yahtml-mode-hook '(lambda () (setq fill-column 78)))
機能は、info に詳しく書かれていますが、主なキーバインドは次の通りです。 下の3つについては上の設定に書いたように外部コマンドを指定しておきます。
[prefix] b | タグ挿入 |
[prefix] l | タグ挿入(一行内) |
[prefix] s | img, imput など終了タグのないもの |
[prefix] m | br とか p など |
[prefix] a | アクセント(<,>,& etc.) |
[prefix] c | タグ変更 |
[prefix] k | タグ削除 |
[prefix] g | タグジャンプ |
[prefix] t j | HTML 構文チェッカ |
[prefix] t p | ブラウザ起動 |
[prefix] t r | (ブラウザへの)再読み込み |
個人的には [prefix] g でタグジャンプ出来るのが結構嬉しかったりします。 また、スタイルシートを指定している場合、その記述を勝手に読み取って、例えば class などを補完機能付きで入力できるのも魅力です。
.emacs.el
に
(autoload 'w3-fetch "w3") (defadvice yahtml-browse-html (around w3m-yahtml-browse-html activate compile) (w3-fetch (ad-get-arg 0))) (autoload 'w3-fetch "w3") (defadvice yahtml-browse-html-2 (around w3m-yahtml-browse-html-2 activate compile) (w3-fetch (ad-get-arg 0)))と書いておけばよいです。