summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-04-10 19:25:52 +0100
committerAlan Pearce2014-04-10 19:25:52 +0100
commitb35c0c6354e54c61e14d6e8b184517bdf47a99cf (patch)
tree1f16939348f0fbde89177be8ee0433642058d34e
parent53017f8e998b30e67ec8a4e2aecf5d5d551e7a4d (diff)
downloaddotfiles-b35c0c6354e54c61e14d6e8b184517bdf47a99cf.tar.lz
dotfiles-b35c0c6354e54c61e14d6e8b184517bdf47a99cf.tar.zst
dotfiles-b35c0c6354e54c61e14d6e8b184517bdf47a99cf.zip
Emacs: use custom style for PHP indentation
-rw-r--r--emacs/init.el22
1 files changed, 21 insertions, 1 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 0cb6bff..b826a0a 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -1094,7 +1094,27 @@ Also returns nil if pid is nil."
             (unbind-key "C-." php-mode-map)
             (if (eq env/location 'home)
                 (setq php-manual-url "http://docs.home/manual/en/"))
-            (add-hook 'php-mode-hook #'php-enable-wordpress-coding-style)
+            (c-add-style "ap"
+                         '((c-basic-offset . 4)
+                           (c-offsets-alist . ((arglist-cont . php-lineup-arglist)
+                                               (arglist-intro . php-lineup-arglist-intro)
+                                               (arglist-close . php-lineup-arglist-close)
+                                               (topmost-intro-cont . (first c-lineup-cascaded-calls
+                                                                            php-lineup-arglist-intro))
+                                               (brace-list-intro . +)
+                                               (brace-list-entry . c-lineup-cascaded-calls)
+                                               (case-label . 4)
+                                               (statement-case-intro . 4)
+                                               (defun-close . 0)
+                                               (defun-block-intro . +)
+                                               (knr-argdecl . [0])
+                                               (arglist-cont-nonempty . c-lineup-cascaded-calls)
+                                               (statement-cont . php-lineup-hanging-semicolon)))))
+            (defun ap/php-style ()
+              (setq indent-tabs-mode t
+                    c-indent-comments-syntactically-p t)
+              (c-set-style "ap"))
+            (add-hook 'php-mode-hook #'ap/php-style)
             (add-hook 'php-mode-hook #'turn-on-eldoc-mode)))
 
 (use-package sgml-mode