branch: elpa/julia-mode
commit 362be602b17412aefe9dca1d68b9ded3121ef025
Merge: 7b1d3fb 6add61b
Author: Yichao Yu <yyc1...@gmail.com>
Commit: GitHub <nore...@github.com>

    Merge pull request #26 from JeffBezanson/master
    
    fix indenting after commented `end`
---
 julia-mode-tests.el | 14 ++++++++++++++
 julia-mode.el       |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 046c959..61d1d31 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -315,6 +315,20 @@ a = 1"
    "# if foo
 a = 1"))
 
+(ert-deftest julia--test-indent-after-commented-end ()
+  "Ignore `end` in comments when indenting."
+  (julia--should-indent
+   "if foo
+a = 1
+#end
+b = 1
+end"
+   "if foo
+    a = 1
+    #end
+    b = 1
+end"))
+
 (ert-deftest julia--test-indent-import-export-using ()
   "Toplevel using, export, and import."
   (julia--should-indent
diff --git a/julia-mode.el b/julia-mode.el
index 97f91c2..09c302f 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -454,7 +454,8 @@ Do not move back beyond position MIN."
         (setq count
               (cond ((julia-at-keyword julia-block-start-keywords)
                      (+ count 1))
-                    ((equal (current-word t) "end")
+                    ((and (equal (current-word t) "end")
+                          (not (julia-in-comment)))
                      (- count 1))
                     (t count))))
       (if (> count 0)

Reply via email to