[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode 2ee8be9 089/352: fix #828
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode 2ee8be9 089/352: fix #828 |
Date: |
Sun, 29 Aug 2021 11:22:21 -0400 (EDT) |
branch: elpa/julia-mode
commit 2ee8be99b9ae475b7fc4e10650b1c32112c6518f
Author: Jeff Bezanson <jeff.bezanson@gmail.com>
Commit: Yichao Yu <yyc1992@gmail.com>
fix #828
thank you, backward-sexp
---
julia-mode.el | 52 ++++++++++++++++------------------------------------
1 file changed, 16 insertions(+), 36 deletions(-)
diff --git a/julia-mode.el b/julia-mode.el
index 13e4809..036faa1 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -95,11 +95,19 @@
(or (equal item (car lst))
(member item (cdr lst)))))
-; TODO: skip keywords and # characters inside strings
-
(defun in-comment ()
- (member ?# (string-to-list (buffer-substring (line-beginning-position)
- (point)))))
+ (save-excursion
+ (block incomment
+ (end-of-line)
+ (backward-char 1)
+ (let ((p0 (line-beginning-position)))
+ (while (>= (point) p0)
+ (if (and (equal (char-after (point)) ?#)
+ (evenp (strcount
+ (buffer-substring p0 (point)) ?\")))
+ (return-from incomment t))
+ (backward-char 1))
+ nil))))
(defun strcount (str chr)
(let ((i 0)
@@ -122,17 +130,17 @@
(not (equal (char-before (point)) ?:))))
(not (in-comment))
(not (in-brackets))
- (member (current-word) kw-list)))
+ (member (current-word t) kw-list)))
; get the position of the last open block
(defun last-open-block-pos (min)
(let ((count 0))
(while (not (or (> count 0) (<= (point) min)))
- (backward-word 1)
+ (backward-sexp)
(setq count
(cond ((at-keyword julia-block-start-keywords)
(+ count 1))
- ((and (equal (current-word) "end")
+ ((and (equal (current-word t) "end")
(not (in-comment)) (not (in-brackets)))
(- count 1))
(t count))))
@@ -148,25 +156,6 @@
(goto-char pos)
(+ julia-basic-offset (current-indentation))))))
-; return indent implied by a special form opening on the previous line, if any
-(defun form-indent ()
- (forward-line -1)
- (end-of-line)
- (backward-sexp)
- (if (at-keyword julia-block-other-keywords)
- (+ 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)
- (+ julia-basic-offset cur)
- nil)))
- nil)))
-
-;(defun far-back ()
-; (max (point-min) (- (point) 2000)))
-
(defmacro error2nil (body) `(condition-case nil ,body (error nil)))
(defun paren-indent ()
@@ -182,14 +171,6 @@
(if (or (= 0 (car p)) (null pos))
nil
(progn (goto-char pos) (+ 1 (current-column))))))
-; (forward-line -1)
-; (end-of-line)
-; (let ((pos (condition-case nil
-; (scan-lists (point) -1 1)
-; (error nil))))
-; (if pos
-; (progn (goto-char pos) (+ 1 (current-column)))
-; nil)))
(defun julia-indent-line ()
"Indent current line of julia code"
@@ -197,8 +178,7 @@
; (save-excursion
(end-of-line)
(indent-line-to
- (or (save-excursion (error2nil (form-indent)))
- (save-excursion (error2nil (paren-indent)))
+ (or (save-excursion (error2nil (paren-indent)))
(save-excursion
(let ((endtok (progn
(beginning-of-line)
- [nongnu] elpa/julia-mode 3ae6315 046/352: improving indenting of block syntax inside parens, (continued)
- [nongnu] elpa/julia-mode 3ae6315 046/352: improving indenting of block syntax inside parens, ELPA Syncer, 2021/08/29
- [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 <=
- [nongnu] elpa/julia-mode 3fe9882 114/352: Add emacs mode usage, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 3913d39 117/352: Add BigInt and BigFloat to julia-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 3cb85b4 141/352: Fixing some byte-compilation warnings., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode c47ccdc 150/352: Highlight parent types in type declarations., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d76f89a 155/352: Preserve point position when indenting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 7eb9038 161/352: Highlight the function name, not the module name, in declarations., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 9795a7c 021/352: Mailmap file to normalize commit names and emails., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 116a9f9 013/352: disabling automatic conversion, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 1f9a1a7 014/352: redesign of type system and its syntax:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode de2a2a3 016/352: Rename: Double => Float64, double => float64., ELPA Syncer, 2021/08/29