[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode 3ae6315 046/352: improving indenting of block s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode 3ae6315 046/352: improving indenting of block syntax inside parens |
Date: |
Sun, 29 Aug 2021 11:22:13 -0400 (EDT) |
branch: elpa/julia-mode
commit 3ae6315aa1e76674fe95136acefe86aa404be78b
Author: Jeff Bezanson <bezanson@post.harvard.edu>
Commit: Yichao Yu <yyc1992@gmail.com>
improving indenting of block syntax inside parens
some cleanup
improving some error messages
less use of jl_show_to_string
---
julia-mode.el | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/julia-mode.el b/julia-mode.el
index daa1fde..f217f32 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -84,8 +84,8 @@
(not (in-comment))
(member (current-word) kw-list)))
-; get the column of the last open block
-(defun last-open-block (min)
+; get the position of the last open block
+(defun last-open-block-pos (min)
(do ((count 0
(cond ((at-keyword julia-block-start-keywords)
(+ count 1))
@@ -95,10 +95,18 @@
(t count))))
((or (> count 0) (<= (point) min))
(if (> count 0)
- (+ 4 (current-indentation))
+ (point)
nil))
(backward-word 1)))
+; get indent for last open block
+(defun last-open-block (min)
+ (let ((pos (last-open-block-pos min)))
+ (and pos
+ (progn
+ (goto-char pos)
+ (+ 4 (current-indentation))))))
+
; return indent implied by a special form opening on the previous line, if any
(defun form-indent ()
(forward-line -1)
@@ -121,8 +129,14 @@
(defmacro error2nil (body) `(condition-case nil ,body (error nil)))
(defun paren-indent ()
- (let* ((p (parse-partial-sexp (point-min) (progn (beginning-of-line)
- (point))))
+ (let* ((p (parse-partial-sexp (save-excursion
+ ;; only indent by paren if the last open
+ ;; paren is closer than the last open
+ ;; block
+ (or (last-open-block-pos (point-min))
+ (point-min)))
+ (progn (beginning-of-line)
+ (point))))
(pos (cadr p)))
(if (or (= 0 (car p)) (null pos))
nil
@@ -151,19 +165,21 @@
(at-keyword julia-block-end-keywords))))
(error2nil (+ (last-open-block (point-min))
(if endtok -4 0)))))
+ ;; previous line ends in =
+ (save-excursion
+ (if (and (not (equal (point-min) (line-beginning-position)))
+ (progn
+ (forward-line -1)
+ (end-of-line) (backward-char 1)
+ (equal (char-after (point)) ?=)))
+ (+ 4 (current-indentation))
+ nil))
;; take same indentation as previous line
(save-excursion (forward-line -1)
(current-indentation))
- ;(save-excursion
- ; (if (and (not (equal (point-min) (line-beginning-position)))
- ; (progn
- ; (forward-line -1)
- ; (end-of-line) (backward-char 1)
- ; (equal (char-after (point)) ?=)))
- ; 4 nil))
0))
- (when (at-keyword julia-block-end-keywords)
- (forward-word 1)))
+ (when (at-keyword julia-block-end-keywords)
+ (forward-word 1)))
(defun julia-mode ()
"Major mode for editing julia code"
- [nongnu] elpa/julia-mode e758c85 001/352: initial empty commit, (continued)
- [nongnu] elpa/julia-mode e758c85 001/352: initial empty commit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 099ca3b 006/352: clarifying some types; using Size and Index where appropriate, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode adaaa34 010/352: fixing parser bug when a file ends with comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0a0b373 008/352: adding some conversion machinery, refactoring generic functions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 3525c74 012/352: implementing typed locations: field, buffer elt, declared local var, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 89e42a4 023/352: Minor updates to julia-mode for Ptr and eval., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode fc44ae6 026/352: more work on type inference; adding isbound(), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 06ff69e 027/352: type does not use block syntax, fix emacs mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 02d443b 034/352: fixing type inference for builtin cases of convert(), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode c01429b 044/352: fixing some integer sizes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 3ae6315 046/352: improving indenting of block syntax inside parens,
ELPA Syncer <=
- [nongnu] elpa/julia-mode dbe56c0 050/352: Work on sparse binary operators, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0bd625b 028/352: misc. stuff:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode efce160 032/352: adding bitstype syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 29c7950 033/352: adding boot.j, allowing us to move more primitive definitions to julia, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 6ae7fab 043/352: improvements to julia-mode indenting:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 2f7441b 058/352: AbstractArray, AbstractVector, AbstractMatrix highlighting in julia-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 1312fa7 062/352: removing Tensor from list of syntax highlighted types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode b35dd82 088/352: more | -> for conversion, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode e225b48 098/352: Update mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 2ee8be9 089/352: fix #828, ELPA Syncer, 2021/08/29