You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code does this if the caret is before = or => and leverage align-regexp, maybe there is another option using cc-engine indentation mechanism that will work with indent-region.
(defunphp--indent-align ()
(interactive)
(cond ((looking-at "[ \t]*=>")
(let* ((begin (cadr (syntax-ppss)))
(end (when begin (condition-case nil (scan-sexps begin 1) ('error nil)))))
(when end
(align-regexp begin (scan-sexps begin 1) "\\(\\s-*\\)=>"))))
((looking-at "[ \t]*=[$ \ta-zA-Z0-9_'\"\\\\]")
(let* ((ss (cadr (syntax-ppss)))
(sp (save-excursion (backward-paragraph 1) (point)))
(begin (if ss (max ss sp) sp))
(es (when ss (condition-case nil (scan-sexps ss 1) ('error nil))))
(ep (save-excursion (forward-paragraph 1) (point)))
(end (if es (min es ep) ep)))
(align-regexp begin end "\\(\\s-*\\)=")))
((indent-for-tab-command))))
The text was updated successfully, but these errors were encountered:
It could be good to easily indent this:
Into:
The following code does this if the caret is before
=
or=>
and leveragealign-regexp
, maybe there is another option using cc-engine indentation mechanism that will work withindent-region
.The text was updated successfully, but these errors were encountered: