branch: elpa/julia-mode
commit 4f72dfa5af900212299133170ddefb45ebfafef4
Merge: e4b3428 8818ede
Author: Yichao Yu <[email protected]>
Commit: Yichao Yu <[email protected]>
Merge pull request #13 from JuliaLang/keywords_in_comments
fix ignoring of keywords inside comments
---
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 ()