Skip to content

Instantly share code, notes, and snippets.

@v2e4lisp
Created October 22, 2013 04:18
Show Gist options
  • Select an option

  • Save v2e4lisp/7095170 to your computer and use it in GitHub Desktop.

Select an option

Save v2e4lisp/7095170 to your computer and use it in GitHub Desktop.
php-mode setup.
(defun unindent-closure ()
(let ((syntax (mapcar 'car c-syntactic-context)))
(if (and (member 'arglist-cont-nonempty syntax)
(or
(member 'statement-block-intro syntax)
(member 'brace-list-intro syntax)
(member 'brace-list-close syntax)
(member 'block-close syntax)))
(save-excursion
(beginning-of-line)
(delete-char (* (count 'arglist-cont-nonempty syntax)
c-basic-offset))))))
(add-hook 'php-mode-hook (lambda ()
(add-hook 'c-special-indent-hook 'unindent-closure)))
(defun wicked/php-mode-init ()
"Set some buffer-local variables."
(c-set-style "linux")
(setq indent-tabs-mode nil)
(setq fill-column 78)
(setq c-basic-offset 4)
(c-set-offset 'arglist-cont 0)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'case-label 2)
(c-set-offset 'arglist-close 0))
(add-hook 'php-mode-hook 'wicked/php-mode-init)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment