(matlab-block-comment-start-re, matlab-block-comment-end-re)
(matlab-ltype-block-comment-start, matlab-ltype-block-comment-end)
(matlab-block-comment-bounds):
DELETED - no longer used.
matlab.el:
(matlab-mode-map): Re-arrange the map.
Delete bindings for return and c-j (use default)
Add comments and build sections.
(matlab-mode): Update comments.
Add electric-indent-functions setting.
Remove matlab-comment-indent as a setting (use nil)
(matlab-return-function, matlab-return, matlab-plain-ret)
(matlab-indent-after-ret, matlab-indent-end-before-ret)
(matlab-semicolon-on-return, matlab-indent-before-ret)
(matlab-linefeed):
DELETED - use default 'newline' and electric indents instead.
(matlab-electric-indent-function):
NEW - auto-reindent when finishing typing end,
else, case, and a few other things.
(matlab-electric-comment):
Re-write to use new APIs from matlab-scan.el.
This enabled deletion of block comment stuff from matlab-syntax.el.
(matlab-comment-line-break-function):
Remove use of 'matlab-indent-line'.
(matlab-comment-indent): Delete (see change in matlab-mode)
tests/metest.el:
Stop using `matlab-block-comment-bounds'. Replace with new API call.
(matlab-font-lock-anchor-variable-match): . is ok in arguments variable names.
tests/blocks.m:
Added sample argument block using variable name as struct with . in it.
(matlab--valid-arguments-keyword-point):
Argument keywords are ok after an 'end' as well - assuming the 'end' is
another argument block - but we don't check that part, just hope for the best.
tests/blocks.m:
Add example with two argument blocks in a row.
(matlab-indent-function-body, matlab-functions-have-end):
Make safe local variable (needed in tests.)
(matlab-line-count-open-blocks, matlab-line-count-closed-blocks):
DELETE - replaced by ...
(matlab-line-count-block-change): New.
Return + or - num based on num of opened or closed blocks that
don't cancel eachother out. Cuts keyword search on line in half.
(matlab-next-line-indentation): Use `matlab-line-count-block-change'
replacing old calls.
Simplify how functions w/ no indent works.
Simplify indent based on indenting block starts and ends.
Simplify number of local variables.
tests/metest.el:
Add new test file for detect and indent.
tests/mfuncnofuncindent.m:
New file with functions with ends but no indent.
Setting w/ local variable.
Verify this mode works.
(matlab--previous-line-indent-recommendation):
If scanning backwards finds empty line @ beginning of buffer,
then just return 0.
tests/indents.m:
Add blank first line to exercise above.
(matlab-indent-past-arg1-functions): Wrap expression
to only be whole-symbols.
(matlab-function-font-lock-keywords): Accomodate change
to above.
tests/indents.el:
Add test that used to indent as if it were a fcn that
indents past arg1, but shouldn't.
(matlab-fl-opt-continuation, matlab-fl-opt-whitespace)
(matlab-fl-fcn-key, matlab-fl-return-args)
(matlab-fl-fcn-name, matlab-fl-fcn-args):
New regex parts for building font lock keywords.
(matlab-function-font-lock-keywords):
Revamp using above keyword parts.
Now handles continuations between different parts of
the function declaration.
tests/fontlock.m:
New tests for various function declaration flavors with
and without ellipsis between differentparts.
(matlab-scan-comment-help-p): After finding prev code line,
move to beginning of that command before detecting the declaration.
(matlab-scan-beginning-of-command): Add a code-only
input to skip comment scanning.
tests/continuations.m:
Add tests with continuations in function declarations to better
test new fcn comment scanning.
(matlab-indent-region, matlab-indent-line):
Remove use of matlab-navigation-syntax.
I don't think we need this anymore - and it messes
up optimzations w/ syntax-ppss anyway.
(matlab-next-line-indentation):
When checking for block-middle or block-case, pass
in the correct lvl1 context for analysis.
Fixes bug w/ indentaion after a middle or case that
has a continuation.
tests/continuations.m:
Add new test cases for elsif and case with continuation.
(matlab-calculate-indentation):
For continued from previous non-continued line, no arrays:
Include indent recommendation from the previous line to account for
indentation under ctrl blocks.
(matlab-next-line-indentation):
While computing startpt, be sure to move pt to the line that was
passed in.
(matlab-find-recent-variable-list): Use new search APIs for keyword
searches.
Fix some misc bugs.
(matlab--complete-compute-search-functions):
New - pulled from below:
(matlab-complete-symbol-local):
Remove code for deriving which functions to use.
Pulled out to support testing.
matlab.el:
(matlab-mcos-innerblock-regexp, matlab-mcos-regexp, matlab-block-beg-pre-if)
(matlab-block-beg-pre-no-if, matlab-block-beg-pre): DELETED
tests/metest.el:
(matlab-complete): New require
(metest-all-syntax-tests): Move stuff around. Add metest-complete-test.
(met-complete-files, met-complete-tools, metest-complete-test): NEW
tests/complete.m:
New file for testing local completion stuff.
(matlab-line-declaration-p): Fix doc.
(matlab-line-first-word-text): New.
matlab.el:
(matlab-defun-regex): DELETED.
(matlab-guess-script-type): Replace use of matlab-defun-regex
with new api style navigation.
(matlab-guess-function-indentation): New way to guess
if a file should have indentation in function body.
(matlab-really-gaudy-font-lock-keywords): for tranpose,
use builtin-face like other operators.
(matlab-mode): When matlab-indent-function-body is 'guess
use new function above.
(matlab-find-prev-code-line, matlab-find-prev-line)
(matlab-prev-line, matlab-valid-end-construct-p): DELETED.
(matlab-mode-vf-block-matches-backward): DELETED
mlint.el:
(mlint-fix-entry): Use new api instead of
matlab-find-prev-code-line.
tests/metest.el:
In end detect test, turn `matlab-indent-function-body' to 'guess.
In test, also validate what the indent value is.
Put value for indent-function-body back to mw standard when done.
tests/empty.m, tests/mclass.m, tests/mfuncends.m
tests/mfuncnoends.m, tests/mfuncnoendblock.m:
Add indent exptect value to file
tests/mfuncnoendindent.m:
New file for testing endless function that should be indented.
(matlab-math-face): New
(matlab-simulink-keyword-face): Inherit from builtin, not type.
(matlab-ignored-comment-face): Remove height change, too disruptive.
(matlab-keyword-list, matlab-keyword-first-on-line-list):
DELETED (now in matlab-scan.el)
(matlab-hg-primitives-list): New name, many new words.
(matlab-constants-keyword-list): Add flintmax.
(matlab-font-lock-regexp-opt): Use symbol ends.
(matlab-font-lock-mcos-keyword-match):
After match, skip over attribute list. Needed for anchored matchers.
(matlab-font-lock-anchor-set-end-limit): Don't change match data.
(matlab-font-lock-anchor-variable-match):
Update regex to be more robust.
Always move endpoint to EOL.
(matlab-basic-font-lock-keywords):
Use symbol end matchers \\_< and \\_> where needed.
Delete crufty old comments.
(matlab-really-gaudy-font-lock-keywords):
Add more logical things and use built-in face on them.
tests/metest.el:
Add new instrumentation options for new faces used by font lockers.
tests/blocks.m, tests/mclass.m:
Fixup for changes in font lock faces used.
(matlab-syntax-commanddual-functions): Add cd and colormap.
(matlab--scan-line-for-command-dual): Make sure case-fold-search set
so we don't match cmd dual if user messes w/ capitalization.
(matlab--font-lock-syntactic-face): Add support for ignored comment face.
(matlab-cursor-comment-string-context): Improve help.
matlab.el:
(matlab-ignored-comment-face): New
tests/metest.el:
(metest-comment-string-syntax-test):
Add ignored comment support.
Add 'regular' code support (ie - not string or comment)
(met-kw-font-alist):
Add ignored comment support.
tests/fontlock.m:
Add tests for ignored comment face.
tests/stringtest.m:
Add ignored cmd dual cases.
Add ignored comment detection and tests.
(matlab-previous-code-line): In case of no comments, also
hand skip over whitespace charts.
tests/metest.el:
Force empty lines to have no spaces, other lines stay the same.
This will exercise bug found above.
tests/indents.m:
Fix mlint error.
(matlab-syntax-support-command-dual): Default to t
(matlab-syntax-commanddual-functions): List of functions
commonly used with command line dual.
(matlab--scan-line-for-command-dual): Use above lists
instead of anti-keyword detection.
tests/fontlock.m, tests/indents.m:
Add tests for command dual.
tests/stringtest.m:
Command dual test updated to use 'disp'
(matlab-kwt-*): New regex caches.
(matlab-keyword-regex): Update to use new caches.
(matlab-compute-line-context-lvl-1): Support %^ ignore comment type
(matlab--scan-next-keyword): New helper fcn.
(matlab-re-search-keyword-forward): Add extra BONUSTEST input.
Used to filter out some kinds of hints by matlab--scan-next-keyword.
matlab.el:
(matlab-font-lock-basic-keyword-match)
(matlab-font-lock-vardecl-keyword-match)
(matlab-fl-anchor-keyword)
(matlab-font-lock-args-keyword-match)
(matlab-font-lock-extend-region)
(matlab-font-lock-anchor-set-end-limit)
(matlab-font-lock-anchor-clear-end-limit)
(matlab-font-lock-anchor-variable-match):
New font lock support features.
(matlab-basic-font-lock-keywords)
(matlab-file-basic-font-lock-keywords)
(matlab-function-font-lock-keywords)
(matlab-file-class-font-lock-keywords):
Use above new font lock keyword matchers.
(matlab-mode): Setup font lock extend region feature.
tests/metest.m:
(met-fontlock-files): Add blocks.m
tests/blocks.m, tests/fontlock.m, tests/mclass.m:
Add new font lock testing instrumentation.
(matlab--font-lock-syntactic-face): Add pragma face support.
matlab.el:
(matlab-string-start-regexp): Delete (unused)
(matlab-font-lock-extend-region): Delete.
block comments now supported natively.
(matlab-pragma-face): New
(matlab-basic-font-lock-keywords):
Delete pragma face support
end & ref keyword regex tweak to use \\_>
(matlab-mode): Don't setup font-lock-extend-region
tests/metest.el:
(met-kw-font-alist):
Add some new face keys to test.
(met-fontlock-files): Add fontlock.m
(metest-fontlock-test): Tweak how multi-fonts on one spot test.
tests/fontlock.m:
New suite of tests.
tests/mclass.m:
Add some more font lock tests.
(matlab-array-continuation-indent-level): New config variable.
(matlab-calculate-indentation-1):
When selecting indentation for within parens, add logic for 2 indent styles
depending on what kind of array continuation we find ourselves in.
Use new array-continuation indent level for inside arrays.
functions, arrays w/ open paren on a line by itself,
and nested arrays indent under their parens.
tests/indents.m:
Add examples of differnet kinds of array continuations.
(matlab--valid-mcos-keyword-point):
When verifying an mcos keyword, be sure to travel to beginning of
command before identifying if it is a class or end.
tests/mclass_cont.m:
New test for above.
tests/metest.el:
Add mclass_cont.m as an indentation test.
(matlab-mode-vf-block-matches-forward): If this buffer has bad
list syntax, don't bother doing any work.
metest.el:
(metest-comment-string-syntax-test):
Add font lock testing to all found comments and strings.
(met-fontlock-files, metest-fontlock-test):
New but empty - TODO to impl this.
(mlf-paren-inner-point): New var.
Renumbered all the other vars.
(matlab-compute-line-context-lvl-1):
Add paren inner point into list.
(matlab-line-close-paren-inner-point): New
matlab.el:
(matlab-calculate-indentation-1):
Update blockendless to use new apis
Update plain code continuations to use new apis
when inside parens.
(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-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.
(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-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.
(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-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.
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.
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-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.
(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-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.