(matlab-indent-region): Add arg to supress progress indicator.
(matlab--change-indentation-override): New feature.
(matlab--indent-line): Extract bit that changes buffer to...
(matlab--change-indentation): New from above.
This fcn is set on the indentation override.
(matlab-calculate-indentation-1, matlab-next-line-indentation):
Pass lvl2 into help scan.
(matlab-compute-line-context-lvl-2): Add cache stats capture.
(matlab-previous-code-line): New fcn.
(matlab-scan-comment-help-p):
first arg can now be lvl1 or 2. If lvl2, use it's cached
lines to compute.
(matlab-mode): Specify indent-region-function.
(matlab-lattr-array-cont): Accept lvl2 input and use it when avail.
(matlab-indent-region): New.
Computes a lvl2 context and maintains it line-to-line.
(matlab-indent-line): Compute a lvl2 context.
Move original contents to matlab--indent-line.
(matlab--indent-line): New per-line indenter.
Takes lvl2 context and passes it through.
(matlab-calculate-indentation): Accept lvl2 context, pass through.
(matlab-calculate-indentation-1): Accept lvl2 context.
Derive lvl1 context from lvl2.
(matlab-next-line-indentation): Accept lvl2 context, and use it.
(matlab-comment-indent): Use renamed matlab--calc-indent.
(matlab-show-line-info): compute lvl2 and use it with above changed apis
matlab-scan.el:
(matlab-line-point, matlab-line-indentation): New
(mlf-* for lvl-2 context): Rename for consistency with what they do.
(matlab-compute-linecontext-lvl-2):
Revampe computing of lvl1 (if not passed in), internal names.
Delete old comment stuff (wasn't used.)
Implement cascading lvl2 maintenance from lvl1-prev, or bobp as nil.
(matlab-line-in-array): New helper.
(matlab-scan-cache-get): Log hits to stats.
(matlab-scan-cache-stats): New var
(matlab-scan-stat-reset): New cmd
(matlab-scan-stat-inc): New
(matlab-scan-stats-print): New
(matlab-last-script-type-guess): New cache.
(matlab-last-guess-decl-p): New fcn, non-nil if fcn or class.
(matlab-guess-script-type): Cache result.
(matlab-beginning-of-command):
Don't ask about help txt if not in a function or class.
(matlab-ltype-code): Fix bug.
(matlab-lattr-block-cont, matlab-lattr-block-close):
Short circuit if not on a code line.
Don't scan into end line comments.
(matlab-calculate-indentation-1)
(matlab-next-line-indentation):
Don't ask about help text if not in function or class script.
(matlab-compute-line-context): Add lvl2 support.
(mlf-indent): New slot
(mlf-end-comment-pt): Rename to match what it is.
(matlab-compute-line-context-lvl-1): Add mlf-indent to output.
(matlab-with-context-line): Macro to just jump to a context.
(matlab-line-comment-ignore-p): Doc fix.
(matlab-line-end-comment-column): Deal with rename of mlf-end-comment-pt.
(matlab-line-end-of-code): New fcn.
(mlf-level1 & others): New
(matlab-compute-line-context-lvl-2): New
(matlab-describe-line-indent-context): Also capture lvl2.
(matlab-find-prev-line):
If 'ignorecomments' specified, use fast `forward-comment'.
Otherwise, convert recursive find into iterative loop.
(matlab-find-code-line):
Replace with faster `forward-comment'.
(matlab-beginning-of-command)
(matlab-ltype-continued-comm):
Replace some calls to use new calls from matlab-scan.
(matlab-ltype-empty, matlab-ltype-comm-noblok)
(matlab-ltype-comm, matlab-ltype-comm-ignore)
(matlab-ltype-code, matlab-lattr-comm)
(matlab-lattr-array-cont):
Swap out old impl with new from matlab-scan.
Replace some calls to use new calls from matlab-scan.
(matlab-calculate-indentation-1):
Replace old call with one from matlab-scan.
Improve control of debugging output by enabling for test script code,
but disabling while running individual tests.
Tests will catch the error, and show the line in the file where
the test failed.
(matlab--scan-line-bad-blockcomment)
(matlab--scan-line-for-ellipsis):
Remove narrowing to region and use search bound instead.
This should be faster.
(matlab--font-lock-syntactic-face):
Quote in all the faces to avoid compiler warning.
Revise to move all message output outside what is being timed.
Move looping over files outside the test functions.
Combine timings from one test point to one number to be recorded.
Reduce # of lines output during test running.
matlab-scan.el:
(mlf-entity-start, mlf-paren-outer-char, mlf-paren-outer-point):
New const, renumber the others.
(mlf-paren-inner-char, mlf-paren-inner-col):
Renamed fro versions w/out -inner in the name.
(matlab-compute-line-context-lvl-1):
Fill in entity start, and outer char/point.
(matlab-line-block-comment-start): New
(matlab-line-close-paren-inner-col, -char):
Renamed to include -inner
(matlab-line-close-paren-outer-char, -point): New
(matlab-line-comment-help-p): Renamed to
(matlab-scan-comment-help-p): Option PT
now specifies if a point is returned instead of a column.
(matlab-scan-previous-line-ellipsis-p): New
(matlab-scan-beginning-of-command): New
(matlab-describe-line-indent-context): Fixup names, etc.
(matlab-beginning-of-command): In comment skip part,
also look for help comments.
(matlab-next-line-indentation): Replace several -lattr-
type commands with new predicates from matlab-scan.el.
matlab-scan.el:
(matlab-line-regular-comment-p): New
(matlab-calculate-indentation-1):
Replace old -ltype- API calls with new API from matlab-scan.el.
Delete chunks of block comment handlers, replaced with simpler
code using matlab-scan stuff.
matlab-scan.el:
(matlab-compute-line-context-lvl-1):
Rename block comment stype values.
When a keyword is found, only enable iff not in parens.
Trailing comment section, if line starts with a comment,
assume it ends with a comment, and compute key values.
(matlab-line-comment-style, matlab-line-end-comment-column)
(matlab-line-ellipsis-p):
New
(matlab-line-end-p, matlab-line-block-middle-p)
(matlab-line-block-case-p):
New
(matlab-line-close-paren-p, matlab-line-close-paren-char)
(matlab-line-close-paren-col):
New
(matlab-describe-line-indent-context):
Fixup for various changes.
New algorithms for scanning MATLAB files for context.
matlab.el:
(matlab-mode-leave): Disable scanner in this buffer.
(matlab-mode): Enable scanner in this buffer.
(matlab-calculate-indentation-1):
Use `matlab-compute-line-context'. Use output for comment detection.
Move block comment stuff first to maintain consistency with old behavior.
Project.ede, Makefile: Add matlab-scan.el
(matlab-beginning-of-command):
Add hack to skip over multiple continued comments very fast.
This is a very specific optimization for many lines of comments.
(matlab-calc-indent):
If current line detects we are in an array continuation, then
it is not necessary to compute next-line indentation from it's context
since you can't have if/end type code in there.
Also, array continuation detection is now very fast.
tests/indents.m:
Added a bunch of misc indenttion tests around nested arrays, cell arrays, etc.
(matlab-show-paren-or-block):
Use `syntax-class' instead of `car' for output of `syntax-after' to get the class.
This strips out high order bits to return the actual syntax #.
(matlab-lattr-cont):
Replace old regexp based searching for ... with use of syntax-ppss,
and using it to find the char that starts the comment, and use to
verify an ellipsis.
(matlab-beginning-of-command): Remove searching for function/block to
restrict motion to. The search and restrict just slowed down ppss.
(matlab-end-of-command): Remove optional input.
Stop restriting array-cont query.
(matlab-semicolon-on-return, matlab-mode-vf-quiesce-buffer):
Don't pass input to `matlab-end-of-command'.
matlab-syntax.el:
(matlab-up-list): Use `matlab-beginning-of-string-or-comment'
instead of asking for the string or commment bounds.
The beginning is part of ppss, but full bounds includes the end.
(matlab-end-of-command):
In first check, swap order looking for array-cont first since it is faster.
(matlab-property-function, matlab-lattr-semantics): Deleted
(matlab-show-cursor-context): Deleted.
matlab-complete.el:
(matlab-lattr-semantics): Moved here from matlab.el
(beginning-of-command): Optimization for very long arrays
where user put ... inside the array.
ie - compute beginning of array bounds first, then look for
continuations.
(matlab-ltype-comm): Make robust to block comment start,
where bounds returns false when on start. Need to also check
for the start of a block comment.
(matlab--maybe-yes-or-no-p): New
(matlab-calcuate-indentation-1):
Use above instead of yes-or-no-p.
metest.el:
(met-end-detect-files): Add mfuncnoendblock.m
mfuncends.m:
Fix expected indentation numbers for continued arrays.
mfuncnoendblock.m:
New.
(matlab-uniquify-list): Move to matlab-complete.el
matlab-syntax.el:
(matlb-beginning-of-string-or-comment): New nav function
matlab-complete.el:
(matlab-uniquify-list): Moved here from matlab.el
(matlab-find-block-comments): Delete
(matlab-file-basic-font-lock-keywords): Remove ref to above.
(matlab-up-string-or-comment, matlab-backward-up-string-or-comment):
Delete.
(matlab-lattr-block-close):
Replace use of matlab-backward-up-string-or-comment with
matlab-beginning-of-string-or-comment.
(metest-error): New function
Adds file / lineno to test errors so you can jump to the right location quickly.
(metest-*-test): Update all functions to use `metest-error'.
(matlab-up-list):
Replaced use of `up-list' when travelling backward.
Instead use `syntax-ppss' and the list of paren positions
to navigate upward while ignoring comments.
When travelling forward, use plain up-list with no
looping.
(matlab-lattr-block-close): After narrowing buffer,
got to eol, not max - as we had to expand the narrowed region
to handle special syntax chars on eol.
metest.el:
(metest-all-syntax-tests): Add ...
(metest-end-detect-test): New test
(met-end-dect-files): New Var
(metest-comment-string-syntax-test)
(metest-sexp-counting-test, metest-sexp-traversal-test)
(metest-indents-test, metest-parse-test):
Use new `metest-find-file' for loading in files.
(met-indents-files): Add mfuncends.m
tests/empty.m:
tests/mfuncends.m:
tests/mfuncnoend.m:
New test files
tests/stringtest.m:
tests/mclass.m:
Add end-detect expected value cookies.
Delete large swaths of code related to syntax tables which
has moved to matlab-syntax.el.
(matlab-syntax): New require.
(matlab-mode-syntax-table, matlab-mode-special-syntax-table):
Moved to matlab-syntax.el
(matlab-font-lock-string-start-regexp)
(matlab-font-lock-string-and-comment-start-regexp)
(matlab-test-allstring-comment-match)
(matlab-font-lock-allstring-comment-match-normal):
No longer needed. Deleted.
(matlab-font-lock-extend-region):
Switch to use matlab-block-comment-bounds.
(matlab-block-comment-*-re, matlab-ltype-block-comment-*):
Moved to matlab-syntax.el
(matlab-basic-font-lock-keywords):
Delete comment and string highlighting.
(matlab-basic-file-font-lock-keywords):
Delete block comment highlighting.
(matlab-mode): Delete all code related to syntax stuff.
Add call to `matlab-syntax-setup'.
Remove `after-change-functions' - no longer needed to handle block comments.
Enable syntax table font-locking comments/strings.
Remove special forward-sexp-function.
(matlab-navigation-syntax, matlab-up-list):
Moved to matlab-syntax.el
(matlab-with-current-command): Extend restricted region 1 char
past eol to include newline - needed for end-of-comment.
(matlab-backward-up-string-or-comment): Fix ellipsis spelling.
Only backup 1 char, reverse scan goes to beginning, not end of ...
(matlab-move-list-sexp-internal)
(matlab-move-simple-sexp-backward-internal)
(matlab-move-simple-sexp-internal)
Deleted.
(matlab-backward-sexp, matlab-forward-sexp)
(matlab-beginning-of-command, matlab-ltype-comm)
(matlab-debug-block-comm)
(matlab-electric-block-comment)
(matlab-show-paren-or-block)
(matlab-mode-vf-block-matches-forward):
Rename matlab-ltype-block-comm to matlab-block-comment-bounds.
(matlab-ltype-block-comm-bounds, matlab-ltype-block-comm-lastcompute)
(matlab-change-funtion, matlab-ltype-block-comm, matlab-ltype-block-comm-1):
Deleted.
(matlab-ltype-block-comm-at-*)
(matlab-cursor-comment-string-context)
(matlab-cursor-in-string-or-comment)
(matlab-cursor-in-comment)
(matlab-cursor-in-string):
Moved to matlab-syntax.el
(matlab-calculate-indentation-1):
Replace old block comment stuff with new `matlab-block-comment-bounds'.
Stop using old cache, just compute bounds once and use it.
tests/mtest.el:
Rename matlab-ltype-block-comm to matlab-block-comment-bounds.
Fix spelling of ellipsis
Add a little more debugging output.
Makefile, Project.ede:
Add matlab-syntax.el
tests/stringtest.m:
Add some blank lines to protect against indentation.
Fix indentation.
(matlab-lattr-block-close): Account for commend imediately after
the end keyword.
tests/blocks.m:
(tightcomments): Add sample with comments tight to end
of every statement with indentation test cookies.
(matlab-valid-end-construct-p): an 'end' after a . is a field,
and not a valid block end.
(matlab-cursor-on-valid-block-start): any block after a . is a field,
and not a valid block start.
mlint.el:
(mlint-lm-missing-end::mlint-fix-entry): Fix too many close )
tests/blocks.m:
Add struct_stuff method to verify not indenting anything after a .
tests/stringtest.m:
Add an invalid block comment (all on one line) with test markers in it.
Add autofix routines for missing ends, and missmatched file/class names.
(mlint-error-id-fix-alist): Add ENDCT2, FNDEF, and MCFIL support.
(mlint-lm-entry::mlint-fix-entry, mlint-lm-*::initialize-instance):
Fix all occurances of :AFTER with :after.
(mlint-lm-function-name): New class.
(mlint-lm-function-name::initialize-instance): New.
(mlint-lm-missing-end): New class.
(mlint-lm-missing-end::mlint-fix-entry): New.
(matlab-block-end-pre): Reverse choice of regex used if functions have end.
This appears to have been backwards for a very long time.
(tests/blocks.m, tests/indents/m, tests/mclass.m):
Save with correct indentation for blank lines.
Add tests with function ... end on the same line.
(matlab-cursor-on-valid-block-start):
Replaced previous fix by only looking at the previous end
and verifying it is indented by the standard level.
This (of course) assumes that the whole file is indented correctly.
Speed up checking for valid class block keywords.
(matlab-find-prev-code-line): New.
Looks for a previous line of code and navs to the beginning of it.
(matlab-cursor-on-valid-block-start):
Stop navigating for full syntactic block check, just look at
prev command and verify it belongs to a class and assume it is correct.
(matlab-previous-line-belongs-to-classdef-p):
New. Verify previous thing is a class based keyword.
(matlab-calculate-indentation-1):
When indenting `end' ask matlab-backward-sexp to not throw errors.