emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/julia-mode e29c02f 064/352: making julia indent amount cus


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode e29c02f 064/352: making julia indent amount customizeable as follows:
Date: Sun, 29 Aug 2021 11:22:16 -0400 (EDT)

branch: elpa/julia-mode
commit e29c02f6105a9ec1aa3efa8176f362fa5aabe184
Author: Jeff Bezanson <bezanson@post.harvard.edu>
Commit: Yichao Yu <yyc1992@gmail.com>

    making julia indent amount customizeable as follows:
    
    (add-hook 'julia-mode-hook
          '(lambda ()
             (setq julia-basic-offset 2)))
---
 julia-mode.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/julia-mode.el b/julia-mode.el
index a371110..d2fcad8 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -121,7 +121,7 @@
     (and pos
         (progn
           (goto-char pos)
-          (+ 4 (current-indentation))))))
+          (+ julia-basic-offset (current-indentation))))))
 
 ; return indent implied by a special form opening on the previous line, if any
 (defun form-indent ()
@@ -129,13 +129,13 @@
   (end-of-line)
   (backward-sexp)
   (if (at-keyword julia-block-other-keywords)
-      (+ 4 (current-indentation))
+      (+ julia-basic-offset (current-indentation))
     (if (char-equal (char-after (point)) ?\()
         (progn
           (backward-word 1)
           (let ((cur (current-indentation)))
             (if (at-keyword julia-block-start-keywords)
-                (+ 4 cur)
+                (+ julia-basic-offset cur)
               nil)))
       nil)))
 
@@ -180,7 +180,7 @@
                            (forward-to-indentation 0)
                            (at-keyword julia-block-end-keywords))))
              (error2nil (+ (last-open-block (point-min))
-                           (if endtok -4 0)))))
+                           (if endtok (- julia-basic-offset) 0)))))
         ;; previous line ends in =
         (save-excursion
           (if (and (not (equal (point-min) (line-beginning-position)))
@@ -188,7 +188,7 @@
                      (forward-line -1)
                      (end-of-line) (backward-char 1)
                      (equal (char-after (point)) ?=)))
-              (+ 4 (current-indentation))
+              (+ julia-basic-offset (current-indentation))
             nil))
         ;; take same indentation as previous line
         (save-excursion (forward-line -1)
@@ -213,6 +213,7 @@
         (list "\\(\"\\(.\\|\\s-\\)*?[^\\\\]\"\\|\"\"\\)" 0
               julia-mode-string-syntax-table)))
   (set (make-local-variable 'indent-line-function) 'julia-indent-line)
+  (set (make-local-variable 'julia-basic-offset) 4)
   (setq indent-tabs-mode nil)
   (setq major-mode 'julia-mode)
   (setq mode-name "julia")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]