From 1b19cbe7b746467b97927a55078f0a7465991e64 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 29 Sep 2012 06:34:07 +0400 Subject: [PATCH] Fix #68 While we're at it, allow empty lines inside a continued expression. --- js2-mode.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/js2-mode.el b/js2-mode.el index a1a3ba37b..365bfa772 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -9658,13 +9658,19 @@ and comments have been removed." (save-excursion (back-to-indentation) (or (js2-looking-at-operator-p) - (when (js2-re-search-backward "\n" nil t) ;; skip comments - (skip-chars-backward " \t") - (unless (bolp) ;; previous line is empty + (when (catch 'found + (while (and (re-search-backward "\n" nil t) + (let ((state (syntax-ppss))) + (when (nth 4 state) + (goto-char (nth 8 state))) ;; skip comments + (skip-chars-backward " \t") + (if (bolp) + t + (throw 'found t)))))) + (backward-char) + (when (js2-looking-at-operator-p) (backward-char) - (when (js2-looking-at-operator-p) - (backward-char) - (not (looking-at "\\*\\|++\\|--\\|/[/*]")))))))) + (not (looking-at "\\*\\|++\\|--\\|/[/*]"))))))) (defun js2-end-of-do-while-loop-p () "Return non-nil if word after point is `while' of a do-while @@ -10108,10 +10114,10 @@ If so, we don't ever want to use bounce-indent." ;; This has to be set before calling parse-partial-sexp below. (inhibit-point-motion-hooks t)) (setq parse-status (save-excursion - (syntax-ppss (point-at-bol))) + (syntax-ppss (point-at-bol))) offset (- (point) (save-excursion - (back-to-indentation) - (point)))) + (back-to-indentation) + (point)))) (js2-with-underscore-as-word-syntax (if (nth 4 parse-status) (js2-lineup-comment parse-status) -- 2.39.2