Reputation: 6939
I need to unset the c-electric-flag and c-syntactic-indentation flags in Emacs23.4 when I open php files which name ends with .html.php, and only for that "name-pattern", because I use php-mode within html-mode and those flags indent the php code not in a proper way.
However, I would like to keep those flags on while editing pure .php files (php controllers, which contain only php source).
How can I do that?
Upvotes: 1
Views: 305
Reputation: 2303
You can archive this by checking file name in php-mode-hook and disable them
if file name is matched to .html.php
like following code.
(defun my-php-mode-hook ()
(when (and (buffer-file-name)
(string-match-p "\\.html\\.php\\'" (buffer-file-name)))
(c-toggle-electric-state -1)
(setq c-syntactic-indentation nil)))
(add-hook 'php-mode-hook 'my-php-mode-hook)
Upvotes: 1