I know this is subjective, but it didn’t feel right being overridden by the editor rules on how the code should look. For quite a while until recently could only partially deactivate the mechanism that automatically handles indentation (there are dozens of functions and variables involved). Luckily I came across a hack that allows to turn off all syntactic indentation that happens within a mode.
; I don't want emacs making changes I can't control in regards of the indentation.
; This is a hairy issue but I want php to be just a major mode with syntax coloring and bracket balancing.
; to use PHP mode, (autoload 'php-mode "php-mode" "PHP editing mode" t) (add-to-list 'auto-mode-alist '("\\.php3\\'" . php-mode)) (add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode)) (add-hook 'php-mode-hook '(lambda () (define-key php-mode-map (kbd "C-c C-c") 'comment-or-uncomment-region) (setq tab-width 4) (highlight-regexp "<\\?php" 'hi-blue) (highlight-regexp "\\?>" 'hi-blue))) (defun my-php-setup () (local-set-key (kbd "TAB") 'tab-to-tab-stop) (local-set-key (kbd "{") 'self-insert-command) ; support for "{" needed (local-set-key (kbd "}") 'self-insert-command) (local-set-key (kbd ":") 'self-insert-command) (local-set-key (kbd ";") 'self-insert-command)) (add-hook 'php-mode-hook 'my-php-setup)