(matlab-lattr-implied-continuation): comment out.
(matlab-lattr-cont): Replace impl w/ new API and ignore implied continuations.
(matlab-find-convenient-line-break): Replace some fcns w/ new versions.
(matlab-auto-fill): Replace some fcns w/ new versions.
(matlab--mk-keyword-node): Include end pt of found node.
(matlab--valid-keyword-node): New
matlab-syntax.el:
(matlab-move-simple-sexp-backward-internal)
(matlab-move-simple-sexp-internal):
Make defsubst.
matlab.el:
(matlab-show-paren-or-block):
Re-write how blocks like if ... end are highlighted to use new utils
in matlab-scan.el.
Delete random commented out code.
Change fcns that ref renamed variables.
(matlab-mode-version): Update!
(matlab-cont-level): Rename to
(matlab-continuation-indent-level): New name
(matlab-case-level): Rename to
(matlab-case-indent-level): New name
(matlab-mode): Doc string tweaks.
(matlab--scan-line-for-unterminated-string): When comment found,
disable all quote chars in the comment.
(matlab--scan-line-comment-disable-strings):
Find all syntax " chars and disable as whitespace.
tests/indents.m:
Add tests with ' in comments that impact indent.
(matlab--valid-mcos-keyword-point, matlab--valid-arguments-keyword-point):
Require these special keywords to be first on the line.
tests/mclass.m:
Add a bunch of badly named methods.
(matlab--scan-block-forward): When fcns have no end, and a new fcn
block start is found and popped, also go to beginning of found keyword
so next forward-sexp sees it and jumps over next fcn.
matlab.el:
(matlab-backward-sexp, matlab-forward-sexp):
Change chars skipped over @ beginning to better represent
what regular forward/backwar-sexp does.
(matlab-next-line-indentation): Add special code for multi-end lines
to find originating line and use that indentation.
tests/continuations.m:
Set the indentation for section previous broken.
(matlab-lattr-block-close):
Stop decrementing for else type keywords.
(matlab-calculate-indentation-1):
Allow block comments to be help comments.
tests/continuations.m:
Add suite of previously failing tests.
tests/indents.m:
Block comments can now be help.
(matlab-scan-block-start-context): New
matlab.el:
(matlab-lattr-block-cont): Rename to
(matlab-lattr-block-open): New name, return 0 not nil.
(matlab--calc-indent, matlab-show-line-info): Call matlab-next-line-indent w/ new inputs.
(matlab-calculate-indentation-1):
Replace old END indent logic with call to `matlab-scan-block-start-context'
and then stabilize dedent to match block start.
(matlab-next-line-indentation): Better inputs based on what's used.
Delete dead code and commented out code.
tests/continuations.m:
Enabled test that now 'works'.
(matlab--buffer-block-tree): Delete
(matlab--scan-block-forward):
Handle case when `matlab-functions-have-end' is false.
(matlab-re-search-keyword-forward,matlab-re-search-keyword-backward):
Handle bounds correctly before restarting a scan.
(matlab-scan-before-change-fcn):
Only clear cached items AFTER the change.
matlab.el:
(matlab-in-command-restriction, matlab-with-current-command)
(matlab-lattr-local-end): DELETE
(matlab-backward-sexp, matlab-forward-sexp):
Reimplement using matlab--scan-block-forward/backward.
(matlab-lattr-block-cont, matlab-lattr-block-close):
Remove narrowing to current command, and use new search utils with bounds.
(matlab-lattr-middle-block-cont): Comment out
tests/metest.m:
(metest-sexp-traversal-test variable): better name.
(metest-sexp-traversal-test): Use new `matlab--scan-block-forward' / backward
instead of orig fcns.
tests/blocks.m:
Tweak a few test points to make them more challenging.
tests/continuations.m:
Added test with continuation, but disabled the problem.
tests/indents.m:
Brought in problem lines that break array sexp w/ ' in continuation
tests/mfuncnoend.m:
Fix whitespace.
tests/mfuncnoendblock.m:
Fix mlint warnings.
Add support for block navigation.
(matlab-on-keyword-p): New
(matlab-kwt-indent, mtlab-kwt-blocks): New regex caches
(matlab-keyword-regex): Update interface to be simpler.
Support more caches for regex.
(matlab-compute-line-context-lvl-1):
Update to use new `matlab-on-keyword-p' feature.
(matlab--buffer-block-tree): New (but not yet used)
(matlab--mk-keyword-node, matlab--known-parent-block): New
(matlab--valid-keyword-point, matlab--valid-arguments-keyword-point): New
(matlab--scan-derive-block-state): New
(matlab--scan-block-forward, matlab--scan-block-forward-up): New
(matlab--scan-block-backward, matlab--scan-block-backward-up): New
(matlab--re-search-keyword-forward, -backward): Moved.
matlab-syntax.el:
(matlab-beginning-of-string-or-comment): Add all-comments optional input.
(matlab-end-of-string-or-comment): Add all-comments optional input.
(matlab-syntax-keyword-as-variable-p): New
(matlab-valid-keyword-syntax): New
(matlab-compute-line-context): Don't change the match data.
(matlab-scan-end-of-command): New
matlab-syntax.el:
Doc string fixes.
matalb.el:
(matlab-find-prev-code-line): Now uses matlab-scan-beginning-of-command
instead of old version.
(matlab-with-current-command): Now uses matlab-scan-beginning-of-command AND
matlab-scan-end-of-command to build the narrowed region.
(matlab-cursor-on-valid-block-start): Make this immune to changes in
match-data from various conditions in the cond statement.
Use new matlab-scan-beginning-of-command instead of old version.
(matlab-beginning-of-command): Now use matlab-scan-beginning-of-command
as default impl. Delete this fcn later.
(matlab-lattr-block-close):
Track original starting pos better, grab line context after moving to start.
tests/metest.el:
Include new continuations.m test file.
tests/continuations.m:
New test file
tests/indents.m:
Move a couple tests into continuations.m
(matlab-syntax-support-command-dual): New way to control
handling command dual syntax in the syntax table.
(matlab--syntax-propertize): Obey above config by
skipping command dual scanning if nil.
tests/stringtest.m:
Add local variables to enable matlab-syntax-support-command-dual for
this file
(matlab-block-keyword-list): Add more keywords.
(matlab-compute-line-context-lvl-1): improve keyword detection
to handle the new types of keywords that don't start blocks.
Improve end of line detection to distinguish command dual from ellipsis.
(matlab-line-commanddual-p): New
(matlab-scan-previous-line-ellipsis-p): Improve how ellipsis is found
to be more explicit.
(matlab-describe-line-indent-context): Show command dual in output.
matlab.el:
(matlab-lattr-cont): Improve how ellipsis is found to be more
explicit.
indents.el:
Add more keyword styles around to deal with command dual problems.
Make accessing keywords easier.
(matlab-keyword-p): New
(matlab-compute-line-context-lvl-1): Use above.
matlab-syntax.el:
Support command dual as a string in the syntax tabe.
(matlab--command-dual-syntax): New syntax type
(matlab--syntax-propertize): Call scanner for command-dual.
(matlab--scan-line-for-command-dual): New.
(matlab--font-lock-syntactic-face):
Detect command dual and provide that face.
Detect cellbreak comments and provide that face.
(matlab-cursor-comment-string-context):
Also detect commanddual strings, and return that status.
matlab.el:
Revamp font lock keywords to take advantage of updates in
`matlab--font-lock-syntactic-face' updates, and to just
lean into use of defface.
(matlab-show-mlint-warnings, matlab-highlight-cross-function-variables):
Make safe local variables.
(matlab-commanddual-string-face): New variable.
(matlab-font-lock-adjustments): Delete as a function and hook setup.
Replace with just the classic defface calls, but cleaned up to
also :inherit from base faces.
(matlab-file-basic-font-lock-keywords): Remove cell break code.
tests/metest.el:
Add tests for commanddual strings.
(metest-comment-string-syntax-test):
Add ability to test for commanddual strings.
tests/stringtest.m:
Add some command dual examples.
(metest-indents-randomize-files):
Force matlab-mode to re-run so script type is recomputed after
extra indent added.
mfunspacey.m:
New file for script type detection tests.
(matlab-kwt-*): New keyword regex caches.
(matlab-keyword-regex, matlab--keyword-regex): New
Create regex for keywords from the keyword table.
(matlab-re-search-keyword-forward, matlab-re-search-keyword-backward):
New search routines that scan for regex outside of strings, comments, and parens.
(matlab-cursor-in-string-or-comment)
(matlab-cursor-in-comment matlab-cursor-in-string)
(matlab-beginning-of-string-or-comment):
Convert to a single line impl.
Convert to defsubst.
(matlab-end-of-string-or-comment)
(matlab-beginning-of-outer-list)
(matlab-end-of-outer-list): New
(matlab-calculate-indentation-1):
when inside parentheticals; capture indentation
of start as our previous indentation.
Later, ignore all that and just use paren column.
Left notes about what else to fix.
tests/indents.m:
Updated to match new indentation logic.
(matlab-scan-previous-line-ellipsis-p):
Return position, not the column.
(matlab-scan-beginning-of-command):
Recompute the line cache as we search backward.
(matlab-scan-after-change-fcn) ->> rename to
(matlab-scan-before-change-fcn)
(matlab-scan-setup, matlab-scan-disable): Use rename.
matlab.el:
(matlab-lattr-block-close): We can sometimes find
a function for files with endless functions.
Prevent this from acting like an end.
(matlab-indent-region): Disable line-to-line caching
of lvl2. It isn't stable.
Move refreshing of lvl2 here, but comment out.
(matlab--indent-line): Stop refreshing lvl2 here.
(matlab--change-indentation):
Prevent indentation of less than 0.
(matlab--calc-indent): Accept a debug sym.
(matlab-show-line-info): Use new matlab--calc-indent api.
(metest-all-syntax-tests): Force files used for intenting to be
pre-spaced incorrectly.
(metest-condition-case-error-msg): Fix how caught errors are thrown.
(met-indents-files): Add mfuncnoendblock.m
(metest-indents-randomize-files): New
Not really random.
(metest-error): Add a buffer excerpt before throwing an error.
tests/indents.m, tests/mfuncends:
Added more indent tests.
tests/mfuncnoendblock.m:
Add more content.
Enable for use in indentation test.
(matlab-next-line-indentation):
Remove navigation syntax, and save excursion, not needed anymore.
Stop computing rc, as that didn't seem to be used anymore.
(matlab--indent-line): refresh the context if the line was indented.
(matlab--change-indentation): Fix bug when diff==0
(matlab--calc-indent): Revamp how we compute stuff before matlab-next-line-indentation.
(matlab-next-line-indentation): Use more of the contexts passed in.
Removed `matlab-with-current-command' use. Replaced with direct call.
This shows we no longer need to narrow the region.
Remove help comment computation - it seemed unused.
(matlab-show-line-info): Update for changed apis.
matlab-scan.el:
(matlab-with-context-line): Fix bug computing pt to move to.
Setup edebug to debug into this macro.
(mlf-previous-line1 & 2): Renamed & new slot.
(mlf-previous-command-beginning): New slot
(matlab-compute-line-context-lvl-2): If avail, store a lvl2 context for
the previous line too.
Transfer the previous command into new lvl2 context.
Add stats logging.
(matlab-refresh-line-context-lvl2): New hook to refresh after an indent.
(matlab-previous-line-lvl2): New accessor that fills in if empty.
(matlab-previous-code-line): Protect against bobp.
(matlab-previous-command-begin): New accessor that fills in if empty.
(matlab-all-syntax-tests):
Reset the scanner cache hit stats and print when done.
(metest-test-error): Var flag.
(mecondition-case-error-msg):
When test flag set, forward the error along.
(metest-error): Set metest-test-error flag to pass errors through.
(metest-indent-counts): New
(metest-indents-test): Remove core test into new fcn.
Now set matlab--change-indentation-override to our fcn for tracking.
Now call matlab-indent-region with flags for testing.
(metest-indents-test-hook-fcn): New fcn that does the test
on each line from indent-region after indentation is compuated.
(make-keyword-table, matlab-scan-stat-reset):
Use matlab-obarray-make compat layer.
(matlab-scan-stats-print):
Use mapatoms instead of obarray-map for compat.
(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.