branch: elpa/julia-mode commit 8818ede7e1bb7d7ab6ce4b5fca6d3c235e21293e Author: Jeff Bezanson <jeff.bezan...@gmail.com> Commit: Jeff Bezanson <jeff.bezan...@gmail.com>
fix ignoring of keywords inside comments This was part of the fix for https://github.com/JuliaLang/julia/issues/15461, but I just noticed that it doesn't work due to a mis-nesting of this one clause. also adds a test for this --- julia-mode-tests.el | 8 ++++++++ julia-mode.el | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/julia-mode-tests.el b/julia-mode-tests.el index bd57f17..647323b 100644 --- a/julia-mode-tests.el +++ b/julia-mode-tests.el @@ -284,6 +284,14 @@ end" end end")) +(ert-deftest julia--test-indent-after-commented-keyword () + "Ignore keywords in comments when indenting." + (julia--should-indent + "# if foo +a = 1" + "# if foo +a = 1")) + (defun julia--run-tests () (interactive) (if (featurep 'ert) diff --git a/julia-mode.el b/julia-mode.el index 4e41075..e9a2c0c 100644 --- a/julia-mode.el +++ b/julia-mode.el @@ -408,8 +408,8 @@ a keyword if used as a field name, X.word, or quoted, :word." (member (current-word t) kw-list) ;; 'end' is not a keyword when used for indexing, e.g. foo[end-2] (or (not (equal (current-word t) "end")) - (not (julia-in-brackets)) - (not (julia-in-comment))))) + (not (julia-in-brackets))) + (not (julia-in-comment)))) ;; if backward-sexp gives an error, move back 1 char to move over the '(' (defun julia-safe-backward-sexp ()