branch: elpa/julia-mode
commit 7f70ddb483dff9abaf47e75db3ae98cc63176f55
Author: Jeff Bezanson <jeff.bezan...@gmail.com>
Commit: Yichao Yu <yyc1...@gmail.com>

    fix to julia-mode for indenting argument lists
---
 julia-mode.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/julia-mode.el b/julia-mode.el
index a982fba..ea0bc54 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -137,11 +137,16 @@
        (not (julia-in-brackets))
        (julia-member (current-word t) kw-list)))
 
+;; if backward-sexp gives an error, move back 1 char to move over the '('
+(defun julia-safe-backward-sexp ()
+  (if (condition-case nil (backward-sexp) (error t))
+      (error2nil (backward-char))))
+
 ; get the position of the last open block
 (defun julia-last-open-block-pos (min)
   (let ((count 0))
     (while (not (or (> count 0) (<= (point) min)))
-      (backward-sexp)
+      (julia-safe-backward-sexp)
       (setq count
            (cond ((julia-at-keyword julia-block-start-keywords)
                   (+ count 1))

Reply via email to