branch: elpa/julia-mode commit 8d6ea60566591992487d80479e634746161debd6 Author: Dan Schmidt <d...@dfan.org> Commit: Yichao Yu <yyc1...@gmail.com>
Fix #11549 (top level after paren-indented line) --- julia-mode.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/julia-mode.el b/julia-mode.el index 1675c39..27c4dd0 100644 --- a/julia-mode.el +++ b/julia-mode.el @@ -452,13 +452,10 @@ with it. Returns nil if we're not within nested parens." (save-excursion (beginning-of-line) (forward-to-indentation 0) - (let ((endtok (julia-at-keyword julia-block-end-keywords))) - (ignore-errors (+ (julia-last-open-block (- (point) julia-max-block-lookback)) - (if endtok (- julia-indent-offset) 0))))) - ;; Otherwise, use the same indentation as previous line. - (save-excursion (forward-line -1) - (current-indentation)) - 0)) + (let ((endtok (julia-at-keyword julia-block-end-keywords)) + (last-open-block (julia-last-open-block (- (point) julia-max-block-lookback)))) + (max 0 (+ (or last-open-block 0) + (if endtok (- julia-indent-offset) 0))))))) ;; Point is now at the beginning of indentation, restore it ;; to its original position (relative to indentation). (when (>= point-offset 0) @@ -622,6 +619,16 @@ c")) " (1)")) + (ert-deftest julia--test-top-level-following-paren-indent () + "`At the top level, a previous line indented due to parens should not affect indentation." + (julia--should-indent + "y1 = f(x, + z) +y2 = g(x)" + "y1 = f(x, + z) +y2 = g(x)")) + (defun julia--run-tests () (interactive) (ert-run-tests-interactively "julia--test")))