emacsã§viewãã¡ã¤ã«ãããããªãweb-modeã使ãã¹ã
htmlã¨PHPãæ··å¨ãããã¡ã¤ã«ããããã¨ããåé¡ã
emacsã§ä½ããã®MVCãã¬ã¼ã ã¯ã¼ã¯ã使ã£ã¦ããã¨ããviewãã¡ã¤ã«ãã©ã®modeã§éãã®ããåé¡ã§ãã ç´ç²ãªHTMLãªãhtml-modeã使ãã°ããã§ãããç´ç²ãªPHPãªãphp-modeã使ãã¨æãã¾ãã
ãããã以ä¸ã®æ§ãªã³ã¼ããåºã¦ããæã©ã¡ãã®ã¢ã¼ãã§éçºãã¦ããã£ãããã¾ããã
<div class="foo"> <?php if ($flg): ?> FLG is ON <?php else:?> FLG is OFF <?php endif ?> </div>
ãã®å¯¾å¦æ¹æ³ãããã¤ã試ãã¦ã¿ãã®ã§ç´¹ä»ãã¾ãã
mmm-mode
https://github.com/purcell/mmm-mode
emacså¤æ¥ããã®æ¹æ³ã ã¨ãmmm-modeã使ãã®ã主æµã£ã½ããããã¯ã1ã¤ã®ãã¡ã¤ã«ã®ä¸ã§è¤æ°ã®ã¡ã¸ã£ã¼ã¢ã¼ãã使ãããã¤ã§ããã
<?php ?> ã§å²ã¾ããéã ãã¯php-modeã«èªåçã«å¤ããã¨ãã£ãå ·åã§ããã ããããªãããããã¾ã使ãåæãæªãã»ã»ã»ã¨ããããªãããã¾ãåããªãã®ã§ããã¾ããã«è©¦ãã¦ãªãã®ã§ãããããªãå¤æ¥ããã®ææ³ã§ããããã¾ã使ããªãã»ããããããªã¼ã¨æãã¾ãã
mumamo-mode
http://www.emacswiki.org/emacs/MuMaMo
ç§ãæè¿ã¾ã§ã¡ã¤ã³ã§ä½¿ã£ã¦ããã®ã¯ãnxhtml-modeã«å«ã¾ãã¦ãããnxhtml-mumamo-modeã¨ãããã¤ã§ãã nxhtml-modeèªä½ãé常ã«ã´ããmodeãªã®ã§ããããã®ãªãã«å«ã¾ãã¦ã¾ãã
ãã¤ãã³ã³ãã¤ã«ããªãã¨ä½¿ã£ã¦ãã¦ã¤ããã®ã§ä½¿ãæã¯ã絶対ã«ãã¤ãã³ã³ãã¤ã«ãã¦ãã ããã
ãã¾ãæºè¶³ãã¦ãªãã£ãã®ã ãã©ãä»ã«é¸æè¢ããªãã¨ããçç±ã§é·å¹´ã¤ãã£ã¦ã¾ããããããããªãããããå¾®å¦ãnxhtml-mumamo-modeã§html-modeã¨php-modeã®æ··å¨ã¯ã§ããã®ã ãã©ã¨ã«ããéããæ¿éãã
ã¡ãã£ã¨å¤§ããã®ãã¡ã¤ã«ã«ãªã£ãç¬éåä½ããã£ãããã¦ä½¿ãã«å¤ããªãã¬ãã«ã«ãªã£ã¦ãã¾ããmodeãoffã«ããã¨ãããã¨ãããã£ã¡ã ãããã¾ããã
ã¾ããhtml5ã«å¯¾å¿ãã¦ããªãã¨ããåé¡ãããã¾ãããä¾ãã°ä»¥ä¸ã®æ§ãªã¤ã³ãã³ããããã¦ãã¾ãã¾ãã
<html> <head></head> <body> <img src="hogehoge" alt="" > <img src="hogehoge" alt="" > <img src="hogehoge" alt="" > <img src="hogehoge" alt="" > </body> </html>
xhtmlã¨ãã¦è§£éããããã\ã§çµãããã¨ãæå¾ ããã¦ãããããªã®ã ãã©ãhtml5ã§ããã°ä¸è¨ã®è¨è¿°ã§ãåé¡ã¯ãªãã¯ãã ãã®ãããããæ°ã«ãªãã®ã§ãã
web-mode
ã¨ããããã§ãæè¿å°å ¥ãã¦æºè¶³ãã¦ããã®ãweb-modeã§ããä¸è¨ã«æ¸ããä¸æºç¹ã¯ã²ã¨éã解æ¶ããã¦ããã¦ããããå¿«é©ã«ä½¿ããã¨ãã§ãã¾ãã
ã¤ã³ã¹ãã¼ã«ã¯ãemacs23以ä¸ã§ããã°elpaããããã¤ã³ã¹ãã¼ã«ããã°OKã
M-x package-list-packages
ä¸è¨ã®ãããªæãã§ãversionã¯6.0.31ãã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã
htmlã¨PHPã®æ··å¨ã¢ã¼ããåé¡ãªã使ãã¾ãããå½ç¶ãCSSãJavascriptãã¾ãã£ã¦ãåé¡ãªãã§ããã¾ããhtml5ãã¡ããã¨è§£éãã¦ããã¦ããããªãã«è»½å¿«ã«åãã¾ãããä»ã®ã¨ããå ¨ãä¸æºã¯ããã¾ããã
å½ç¶html+phpã ãã§ãªããerbãjspãªã©ã«ã対å¿ãã¦ãã¾ããããªãå¹ åºã対å¿ãããã¨ãã§ããã®ã§ã¯ãªãã§ããããã
ç§ã¯ãã¡ããåèã«ãã¦ä»¥ä¸ã®è¨å®ãå ¥ãã¦ãã¾ãã
ãªããç§ã¯cakephpãæ¥åã§ã¯ä¸»ã«ä½¿ã£ã¦ããã®ã§ãctpãã¡ã¤ã«ã®æä½ãä¸å¿ã«è¨å®ãã¦ãã¾ãã
;; web mode ;; http://web-mode.org/ ;; http://yanmoo.blogspot.jp/2013/06/html5web-mode.html (require 'web-mode) (add-to-list 'auto-mode-alist '("\\.ctp\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) ;; web-modeã®è¨å® (defun web-mode-hook () (setq web-mode-markup-indent-offset 2) (setq web-mode-css-indent-offset 2) (setq web-mode-code-indent-offset 2) (setq web-mode-engines-alist '(("php" . "\\.ctp\\'")) ) ) (add-hook 'web-mode-hook 'web-mode-hook) ;; è²ã®è¨å® (custom-set-faces '(web-mode-doctype-face ((t (:foreground "#82AE46")))) '(web-mode-html-tag-face ((t (:foreground "#E6B422" :weight bold)))) '(web-mode-html-attr-name-face ((t (:foreground "#C97586")))) '(web-mode-html-attr-value-face ((t (:foreground "#82AE46")))) '(web-mode-comment-face ((t (:foreground "#D9333F")))) '(web-mode-server-comment-face ((t (:foreground "#D9333F")))) '(web-mode-css-rule-face ((t (:foreground "#A0D8EF")))) '(web-mode-css-pseudo-class-face ((t (:foreground "#FF7F00")))) '(web-mode-css-at-rule-face ((t (:foreground "#FF7F00")))) )
ä»ã«é¸æè¢ãããã°
ä»ã®ã¨ãããweb-modeããã¹ããªé¸æè¢ã ã¨ããã£ã¦ããã®ã ãã©ä»ã«ãªã«ãããã°æãã¦ä¸ããããªããªãemacsã®æ å ±ã£ã¦ã²ããã®ã大å¤ã§ããããã