Wei Weng <ww
...@localhost.localdomain> writes:
> Has anyone tried to use mmm-mode with HTML and PHP?
> It doesn't indent my php code for some reason, whenever I use <tab>, I
> lose indentation on the line.
I use Emacs 21.3 (built from CVS) with mmm-mode 0.4.7, php-mode 1.0.4
and c-mode 5.30 (this is important, because php-mode is derived from
c-mode). The following setup works for me:
(require 'mmm-mode)
(require 'mmm-sample)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'ehtml-mode "\\.php3?\\'" 'html-php)
(mmm-add-mode-ext-class 'ehtml-mode nil 'embedded-css)
(mmm-add-mode-ext-class 'ehtml-mode nil 'html-js)
(mmm-add-classes
'((html-php
:submode php-mode
:front "<\\?\\(php\\)?"
:back "\\?>")))
;; fix for newer emacsen/c-modes
(let ((vars '(c-any-class-key
c++-template-syntax-table
c-<-op-cont-regexp
c->-op-cont-regexp
c-after-suffixed-type-decl-key
c-after-suffixed-type-maybe-decl-key
c-any-class-key
c-asm-stmt-kwds
c-bitfield-kwds
c-block-decls-with-vars
c-block-stmt-1-key
c-block-stmt-1-kwds
c-block-stmt-2-key
c-block-stmt-2-kwds
c-brace-list-key
c-cast-parens
c-class-key
c-class-kwds
c-colon-type-list-re
c-comment-start-regexp
c-cpp-defined-fns
c-decl-block-key
c-decl-prefix-re
c-decl-spec-kwds
c-doc-comment-start-regexp
c-expr-kwds
c-identifier-key
c-identifier-last-sym-match
c-identifier-start
c-identifier-syntax-modifications
c-identifier-syntax-table
c-in-comment-lc-prefix
c-inexpr-block-kwds
c-inexpr-class-kwds
c-keywords
c-keywords-obarray
c-keywords-regexp
c-known-type-key
c-label-key
c-label-kwds
c-label-kwds-regexp
c-lambda-kwds
c-literal-start-regexp
c-nonsymbol-chars
c-nonsymbol-token-regexp
c-not-decl-init-keywords
c-opt-<>-arglist-start
c-opt-<>-arglist-start-in-paren
c-opt-<>-sexp-key
c-opt-access-key
c-opt-asm-stmt-key
c-opt-bitfield-key
c-opt-block-decls-with-vars-key
c-opt-block-stmt-key
c-opt-cpp-prefix
c-opt-cpp-start
c-opt-decl-spec-key
c-opt-friend-key
c-opt-identifier-concat-key
c-opt-inexpr-block-key
c-opt-inexpr-brace-list-key
c-opt-inexpr-class-key
c-opt-lambda-key
c-opt-method-key
c-opt-postfix-decl-spec-key
c-opt-type-component-key
c-opt-type-concat-key
c-opt-type-modifier-key
c-opt-type-suffix-key
c-other-decl-block-key
c-other-decl-block-kwds
c-other-decl-kwds
c-overloadable-operators-regexp
c-paragraph-separate
c-paragraph-start
c-paren-stmt-key
c-primary-expr-regexp
c-primitive-type-key
c-primitive-type-kwds
c-protection-kwds
c-recognize-<>-arglists
c-recognize-knr-p
c-recognize-paren-inits
c-recognize-typeless-decls
c-regular-keywords-regexp
c-simple-stmt-key
c-simple-stmt-kwds
c-special-brace-lists
c-specifier-key
c-specifier-kwds
c-stmt-delim-chars
c-stmt-delim-chars-with-comma
c-string-limit-regexp
c-symbol-key
c-symbol-start
c-syntactic-eol
c-syntactic-ws-end
c-syntactic-ws-eol
c-syntactic-ws-start
c-type-decl-prefix-key
c-type-decl-suffix-key
c-type-prefix-key
comment-end
comment-start
comment-start-skip)))
(mapc (lambda (x)
(add-to-list 'mmm-save-local-variables `(,x nil ,mmm-c-derived-modes)))
vars))
hth,
noniq