[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode 05f002c 203/352: When indenting code, limit how
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode 05f002c 203/352: When indenting code, limit how far back we search. |
Date: |
Sun, 29 Aug 2021 11:22:45 -0400 (EDT) |
branch: elpa/julia-mode
commit 05f002c685482f24277557dafc972ad5cc88ef4a
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Yichao Yu <yyc1992@gmail.com>
When indenting code, limit how far back we search.
Fixes https://github.com/JuliaLang/julia/issues/9254 -- performance is
just too bad on long files otherwise.
---
julia-mode.el | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/julia-mode.el b/julia-mode.el
index fa0b3a0..788a116 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -322,6 +322,8 @@ Do not move back beyond position MIN."
(defun julia-last-open-block (min)
"Move back and return indentation level for last open block.
Do not move back beyond MIN."
+ ;; Ensure MIN is not before the start of the buffer.
+ (setq min (max min (point-min)))
(let ((pos (julia-last-open-block-pos min)))
(and pos
(progn
@@ -334,12 +336,26 @@ beginning of the buffer."
(unless (eq (point) (point-min))
(backward-char)))
+(defvar julia-max-paren-lookback 400
+ "When indenting, don't look back more than this
+many characters to see if there are unclosed parens.
+
+This variable has a major effect on indent performance if set too
+high.")
+
+(defvar julia-max-block-lookback 5000
+ "When indenting, don't look back more than this
+many characters to see if there are unclosed blocks.
+
+This variable has a moderate effect on indent performance if set too
+high.")
+
(defun julia-paren-indent ()
"Return the column position of the innermost containing paren
before point. Returns nil if we're not within nested parens."
(save-excursion
- (let ((min-pos (or (julia-last-open-block-pos (point-min))
- (point-min)))
+ (let ((min-pos (max (- (point) julia-max-paren-lookback)
+ (point-min)))
(open-count 0))
(while (and (> (point) min-pos)
(not (plusp open-count)))
@@ -383,7 +399,7 @@ before point. Returns nil if we're not within nested
parens."
(beginning-of-line)
(forward-to-indentation 0)
(let ((endtok (julia-at-keyword julia-block-end-keywords)))
- (ignore-errors (+ (julia-last-open-block (point-min))
+ (ignore-errors (+ (julia-last-open-block (- (point)
julia-max-block-lookback))
(if endtok (- julia-basic-offset) 0)))))
;; Otherwise, use the same indentation as previous line.
(save-excursion (forward-line -1)
- [nongnu] elpa/julia-mode c3d3e3a 182/352: Don't call parse-partial-sexp to find the last opening paren., (continued)
- [nongnu] elpa/julia-mode c3d3e3a 182/352: Don't call parse-partial-sexp to find the last opening paren., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode c45c786 335/352: Add more tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 549a7b4 341/352: Remove C_NULL from constants and add Cvoid, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 13a3c53 344/352: Merge branch 'master' into triple-quote-cmd, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ac7431c 174/352: Mark @ and ! as a symbol constituents, as suggested by @Clemens-H., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ac55340 175/352: Factoring out a types regex., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d96a08c 180/352: Refactoring julia-char-regex as an rx form., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 76d5d75 183/352: Optimising julia-at-keyword., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 9cdad57 187/352: Make julia-char-regex stricter., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ff5fc36 202/352: julia-mode.el: allow space or no space after :: and <:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 05f002c 203/352: When indenting code, limit how far back we search.,
ELPA Syncer <=
- [nongnu] elpa/julia-mode 70bbe82 204/352: Adding unit tests for indentation., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ff8adf5 221/352: Add tests for #11684. [ci skip], ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8ab2a60 222/352: julia-paren-indent skips blanks after paren, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode c8dfbe2 227/352: Declare indentation as customizable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 011435c 237/352: julia-mode: Fix indent for hanging ops and module, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode c2f0ed8 235/352: julia-mode: Fix prompt regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode a95b06b 252/352: Merge pull request #20 from tpapp/indent-export, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 847908e 249/352: Add indent for import and export., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 7b1d3fb 253/352: Merge pull request #21 from kshramt/python-paren-indent, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f591c6d 275/352: Merge pull request #41 from rfourquet/rf/where-return, ELPA Syncer, 2021/08/29