branch: scratch/editorconfig-cc
commit 7fb0f85010d9aad37cb35fc1b2023bfa7a6a1ade
Author: 10sr <[email protected]>
Commit: Stefan Monnier <[email protected]>
Add php-mode to indentation-alist and add a short note
About `php-mode-coding-style'.
They basically do this at mode startup: "if php-mode-coding-style is
'pear' (which it is by default), add a c-style called 'pear' and
switch to it", and that style contains a c-basic-offset value. But
since we're hooking later than that, we're welcome to override
c-basic-offset without any risk.
Also, php-mode suggests manually typing "nxml-mode" and "js2-mode" and
"web-mode" and then "php-mode" etc, to switch editing styles if you
have a document with multiple types of content (which is common in
.php files), and every time you type php-mode, it runs that style
injection again and resets c-basic-offset.
However, editorconfig runs as a hook when the major mode changes,
so it still re-applies the correct offset every time that happens.
See #116 for more details.
---
editorconfig.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/editorconfig.el b/editorconfig.el
index 3291a9b923..cd68c17a56 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -136,6 +136,11 @@ show line numbers on the left:
(objc-mode c-basic-offset)
(octave-mode octave-block-offset)
(perl-mode perl-indent-level)
+ ;; No need to change `php-mode-coding-style' value for php-mode
+ ;; since we run editorconfig later than it resets `c-basic-offset'.
+ ;; See https://github.com/editorconfig/editorconfig-emacs/issues/116
+ ;; for details.
+ (php-mode c-basic-offset)
(pike-mode c-basic-offset)
(ps-mode ps-mode-tab)
(puppet-mode puppet-indent-level)