branch: externals/phps-mode commit 6a49784b8b1f6f8bf4df48a85ca1efa665dc2e00 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
When indentation search previous code lines it skips commented out lines --- phps-mode-indent.el | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/phps-mode-indent.el b/phps-mode-indent.el index 36ba5ee371..7c298cf3dd 100644 --- a/phps-mode-indent.el +++ b/phps-mode-indent.el @@ -157,6 +157,7 @@ ;; Try to find previous 2 non-empty lines (let ((line-is-empty-p t) + (line-is-comment-p t) (searching-previous-lines 2)) (while (and (= (forward-line -1) 0) @@ -171,7 +172,14 @@ (string-match-p "^[ \t\f\r\n]*$" line-string)) - (unless line-is-empty-p + (setq + line-is-comment-p + (string-match-p + "^[\t ]*\\(//\\|#\\)" + line-string)) + (unless (or + line-is-empty-p + line-is-comment-p) (cond ((= searching-previous-lines 2) (setq @@ -260,17 +268,6 @@ (cond - ;; // die( - ;; echo 'here'; - ((string-match-p - "^[\t ]*//" - previous-line-string) - (when current-line-starts-with-closing-bracket - (setq - new-indentation - (- new-indentation tab-width)) - )) - ;; class MyClass implements ;; myInterface ;; or