Commit graph

480 commits

Author SHA1 Message Date
Eric Ludlam
4ed7821a04 matlab.el:
(matlab-mode-vf-add-end-to-this-block):
when adding end to end of buffer, be sure
to add CR @ beginning in case of no CR at end of last line
of code.
2019-11-15 18:20:06 -05:00
Eric Ludlam
a2d6f97b68 matlab-topic.el:
Add autoload cookie
2019-11-15 12:56:54 -05:00
Eric Ludlam
55f8b11132 matlab-shell.el:
(matlab-shell-region-command):
If the region we are going to run is only 1 line long, use the old
mechanism of just pasting the line onto the commandline.
2019-11-14 21:33:41 -05:00
Eric Ludlam
d06598d24d matlab.el:
(matlab-mode-map): Add ctrl-ret to be matlab-shell-run-region-or-line.
2019-11-14 21:32:35 -05:00
Eric Ludlam
5f7dc852cf toolbox/emacsinit.m:
Now that we simulate hotlink generation, we no longer need
the complex version check and related code.  Just turn off
graphical debugging by default.
2019-11-14 21:31:46 -05:00
Eric Ludlam
339b9673cf Add .#* matcher to ignore some new tmp file. 2019-11-14 19:58:46 -05:00
Eric Ludlam
1db3f203be mlint.el:
Fix to work w/ newer eieio.
(initialize-instance, initialize-instance):
Use oref-default to get class values.
(mlint-clear-cross-function-variable-highlighting):
Use font-lock-flush to fix compiler warnings.
2019-11-14 19:58:06 -05:00
Eric Ludlam
8fd24cc16a matlab-shell.el:
Fix compiler warning around company-mode.
(matlab-shell): If company is requested and available, turn it on.
2019-11-14 19:56:06 -05:00
Eric Ludlam
5ce3ad95db Merge branch 'modernize' of ssh://git.code.sf.net/p/matlab-emacs/src into modernize 2019-11-13 22:20:22 -05:00
Eric Ludlam
36c17d9e57 matlab-semantic.el:
New fcns needed by matlab-shell.el
(matlab-semantic-get-local-functions-for-script):
New.  Returns fcns from a buffer.  Works if semantic isn't enabled.
(matlab-semantic-tag-text): get text part of input TAG.
(semantic-default-matlab-setup): Add 'type tag class to list
of misc things, since we support them now.
matlab-shell.el:
(matlab-shell-extract-region-to-tmp-file): Use new fcns above.
Fix compiler warnings.
2019-11-13 22:15:08 -05:00
Eric Ludlam
78c412586b matlab-shell.el:
(matlab-shell-extract-region-to-tmp-file):
Fetch tags before doing the search for functions tags.
Give emacs a chance to flush MATLAB's output queue
before setting up prompt hook.
2019-11-13 20:28:13 -05:00
Eric Ludlam
94748c221c semantic-matlab.el:
(semantic-matlab-parse-oldstyle-class)
(semantic-matlab-find-oldstyle-classes): Comment out.
Need to delete later.
(semantic-matlab-parse-region): Stop using above.
2019-11-13 09:15:00 -05:00
Eric Ludlam
1ff16e4ade Support running a cell from script w/ local functions.
matlab-shell.el:
(gud-matlab-marker-regexp-plain-prompt): New regexp.
(matlab-shell-prompt-appears-hook): New hook (used below)
(gud-matlab-marker-filter): When returning output, if a prompt is
included, call the matlab-shell-prompt-appears-hook.
(matlab-shell-run-cell, matlab-shell-run-region-or-line): Move
(matlab-shell-run-region): Extract inline code to find 'command' to new fcn.
(matlab-shell-region-command): Function to extract code to run as cmd.
(matlab-shell-region->commandline): Copy from run-region as new fcn.
Fix up to better clean up blank lines, and excessive whitespace.
(matlab-shell-extract-region-to-tmp-file): NEW.
This is like region->commandline but puts content into a speicially named
m file.  If any functions are needed from the script, pull those along.
(matlab-shell-cleanup-extracted-region): Delete files created by above.
Called from the new hook.
2019-11-12 23:14:52 -05:00
Eric Ludlam
1734085cbc Fix bug in semantic-matlab-parse-functions - it needs to take limit input. 2019-11-12 23:09:28 -05:00
Eric Ludlam
af8e183cdf Remove all code gen / insertion stuff into matlab-cgen.el.
Move tempo tags var into matlab-cgen, along with all related keymaps.
In matlab-cgen, define the keymap as autoload so things load and
run seamlessly.
On cgen load, run hook on all matlab buffers.
2019-11-10 08:43:26 -05:00
Eric Ludlam
3fe52b0915 Makefile, */Makefile: Update version numbers.
toolbox/Makefile, toolbox/Project.ede: Add dbhotlink.m.
matlab.el: Clean up compiler warnings.
2019-11-09 22:07:52 -05:00
Eric Ludlam
c29e72a9f4 matlab-shell.el: Fix debugging in matlab-shell.
(matlab-shell-mode): Remove calls to dbhotlink from all gud-* commands.
(gud-matlab-dbhotlink): New state variable for when we are waiting
for output from hotlink command.
(gud-matlab-marker-filter): Stop checking for frames so much.
If no frame was found, and if we haven't asked for a frame, then
ask ML to run dbhotlink (from our local toolbox.)
If we are waiting for a hotlink, then search output for the
hotlink command, and strip it out of the process output.
Where we try to hold back output, restrict it to new state variable.
Where we always dump our output, restrict to prompts only.
(matlab-shell-tab): Don't use company mode if not active.

Fix misc compiler warnings.

dbhotlink.m:
If no input, determine current stack position and show that.
Also don't print stack # if in auto mode.
2019-11-09 22:05:50 -05:00
Eric Ludlam
21402281fd matlab.el: Improve block comment handling.
(matlab-font-lock-extend-region): is now added to font-lok-extend-region-functions
and handles block comment bounds.
(matlab-ltype-block-comm): now returns the bounds of the block comment
the cursor is in.  (It had to find them anyway, so now it returns them.)
(matlab-show-paren-or-block): Now does nothing if in a block comment.
(matlab-mode-vf-block-matches-forward): Also ignores hits in block comments.
tests/mpclass.m: Minor tweaks from testing.
2019-11-09 19:23:02 -05:00
Eric Ludlam
58fa0d27fe Automatically add ends to functions:
Add `matlab-mode-vf-add-ends' to `matlab-mode-verify-fux-functions'.
New fix function calls `matlab-mode-vf-block-matches-forward' with ADDEND input.
When an unterminated block appears, if functions have ends, offer to
add an END at a reasonable spot.

Remove "Highlight matching blocks" menu customizations as it isn't used anymore
due to parens mode support.
2019-11-09 14:02:18 -05:00
Eric Ludlam
1a6a3f6a42 Update font-lock keywords for functions so that
scanning for inputs works across multiple lines.
Add fontlock.m test file.
2019-11-09 12:01:34 -05:00
Eric Ludlam
bfbd689d2f Fix previosu fix to `matlab-indent-line' to take into account
the starting indentation when deciding if to move the cursor after
indentation has been done.
2019-11-09 11:10:28 -05:00
Eric Ludlam
5754f52919 Fix matlab-comment' to have features of comment-dwim' when
the region is active.
Fix `matlab-indent-line' to better preserve cursor location in text.  This
has the side-effect of making matlab-comment place the cursor in a better spot
when inserting a new trailing comment.
2019-11-09 10:59:41 -05:00
Eric Ludlam
18a2314b2f semantic-matlab.el:
Add support for parsing superclasses and storing in tag.
Add a test for that.
2019-11-09 10:24:43 -05:00
Eric Ludlam
abaadab8a7 semantic-matlab.el:
Add support for method attributes (protection).
Add test.
2019-11-09 10:16:18 -05:00
Eric Ludlam
bc26e2f978 semantic-matlab.el:
Class parsing - add support for property blocks and creating tags
for the properties, including analysis of 'access' attribute.
Add tests for this.
2019-11-09 08:57:23 -05:00
Eric Ludlam
64f2249b1e Add support for parsing MATLAB Classes to semantic-matlab.el
Add test file (mplass.m) and add parsing testing to metest.el.
2019-11-08 23:34:40 -05:00
Eric Ludlam
9eaf9e7752 Overview:
Move large chunks of matlab.el to matlab-complete.el,
matlab-shell.el, and matlab-topic.el.
Update existing .el files to require new files as needed.
Update Makefiles to no longer have Makefile check.

matlab.el: Settings updates:
(matlab-mode-version): Update to 4.0 (based on expectations of this change.)
(matlab-functions-have-end): set to t.  Fix doc.
(matlab-functions-have-end-p): If guess, then guess, otherwise
base it on matlab-functions-have-end.
(matlab-fill-code): set to nil.
(matlab-keyword-list, matlab-block-end-pre-if): remove endfunction
(matlab-calculate-indentation): remove matlab-ltype-endfunction-comm.

matlab.el: code moving
(matlab-frame-init): moved earlier near keymaps.
2019-11-08 20:49:50 -05:00
Uwe Brauer
2586463ee0 Merge sourceforge (master) with github mirror. 2019-10-10 10:05:03 +03:00
Uwe Brauer
e8d02b83ee Merge string into master 2019-10-10 09:53:17 +03:00
Eric Ludlam
4e57525557 Fix a suite of compiler warnings:
matlab-arg1-max-indent-length, matlab-elipsis-string, matlab-fill-count-ellipsis-flag,
matlab-shell-history-file - add defcustom opts.
Remove matlab-ispell-comments
Rename matlab-ispell-strings to be matlab-ispell-strings-and-comments.
2019-10-09 21:16:06 -04:00
Eric Ludlam
f9ed0ef055 In matlab-show-paren-or-block - fix usage of condition-case. 2019-10-09 21:04:55 -04:00
Uwe Brauer
505d239169 Merged sourceforge with github.
matlab.el: String & Comment Font Lock Handling
        (matlab-mode-syntax-table): Add " as puncutation.
        (matlab-string-char-regexp): New
        (matlab-string-start-regexp): Add "
        (matlab-string-content-regexp, matlb-string-end-regexp)
        (matlb-match-string-end-for-string)
        (mtlab-font-lock-string-match-normal)
        (matlab-font-lock-string-match-unterninated)
        (matlab-font-lock-string-match-here)
        (matlab-font-lock-comment-match, ): Deleted
        (matlab-font-lock-string-start-regexp): New
        (matlab-font-lock-string-and-comment-start-regexp): New
        (matlab-font-lock-allstring-comment-match-normal): New
        (matlab-test-allstring-comment-match): New interactive tester for
        fontlocked strings and comments.
matlab.el Misc Font Lock improvements
        (matlab-handle-simulink): Remove option.  Always
        highlight simulink keywords.
        (matlab-keyword-list): Remove classdef - this is handled diretly.
        (matlab-simulink-keywords, matlab-constants-keyword-list): New,
        moved out of explicit font lock expression.
        (matlab-font-lock-regexp-opt): New fcn used in place of
        regepxp-opt to simplify font-lock keywords, and maintain
        compatibility.
        (matlab-font-lock-keywords): Replace old charvect and comment
        matchers with new unified string and comment matcher.
        Replace all calls to regexp-opt with matlab-font-lock-regexp-opt.
        Replace hard-coded lists of keywords with call to *-regexp-opt.
        (matlab-function-font-lock-keywords): New, derived from gaudy
        keywords.
        (matlab-class-attributes-list-re,matlab-class-font-lock-keywords): New
        (matlab-gaudy-font-lock-keywords): Now built from function and
        class keywords list.
        (matlab-realy-guady-font-lock-keywords): Replace obsolete
        font-lock-type-face.
        Remove continuation expression (now handled in combined
        string/comment highlighter).
        Replace all calls to regexp-opt with matlab-font-lock-regexp-opt.
        (matlab-mode): Add support for font-lock-multiline.
        If show-paren-mode is available, use that instead of built-in
        block highlighting.
        (matlab-ispell-strings-region): Use new font lock matcher for strings.
        (matlab-valid-end-construct-p): Don't modify match-data.
matlab.el Block and Comment navigation
        (matlab-up-string-or-comment, matlab-backward-up-string-or-comment): New
        (matlab-move-list-sexp-internal): New (only list like expressions)
        (matlab-move-simple-sexp-backward-internal): New (call below)
        (matlab-move-simple-sexp-internal): New, nav comments, strings, and
        lists.
        (matlab-backward-sexp): Nav simple-sexp (as above).
        Fix bug with noerror version if there are stacks of incomplete ends.
        (matlab-forward-sexp): Nav w/ simple-sexp (as above)
        instead of using built-in forward-sexp when not navigating blocks.
        (matlab-forward-sexp): Add 'autostart' optional input.
        (matlab-lattr-block-close): Account for ends in comments and strings.
        (matlab-show-cursor-context): New debug command for testing what is
        under the cursor.
        (matlab-cursor-comment-string-context): New detector fcn for strings and
        comments.
        (matlab-ursor-in-string-or-comment, matlab-cursor-in-comment)
        (matlab-cursor-in-string): Delete impl, use above detector instead.
matlab.el: show-paren-mode support
        (matlab-show-paren-or-block): Function called from show-paren-mode to
        identify what to highlight.  Use new navigation system to identify
        matching parens and block keywords.
tests/metest.el: New set of Emacs tests.
tests/metest.sh: Shell script to run tests.
tests/strings.el, tests/expressions.m, tests/mclass.m: New MATLAB
        files with various syntaxes and test tokens used to verify new behavior.
2019-10-09 18:31:07 +03:00
Uwe Brauer
87c49fdbde Merge remote-tracking branch 'origin/strings' 2019-10-09 16:29:37 +03:00
Eric Ludlam
f0781d1f2c Fix spurious character inseted. 2019-10-06 21:41:11 -04:00
Eric Ludlam
b3c06728ef In matlab-mode, setup `forward-sexp-function' so any random tools using it (like blink-paren-mode) will
get the benefits of our fancy matlab specific sexp navigation.
2019-10-06 21:40:06 -04:00
Eric Ludlam
a58df74bf1 metest.el - add metest-indents-test and support functions.
Tweak how all the test status msgs are printed to be better seperated.
Add indentation tokens to mclass.
Add new indents.m
2019-10-03 21:15:41 -04:00
Eric Ludlam
43568c6b89 matlab-backward-up-string-or-comment - Fix paren missmatch, return t always when ctxt is non-nil.
matlab-show-paren-or-block - Do all searches with matlab-navigation-syntax.
2019-10-03 21:13:54 -04:00
Eric Ludlam
d4fb714506 More updates to changelog. 2019-10-02 23:03:45 -04:00
Eric Ludlam
290f8efb39 mtlab-valid-end-construct-p - Add save-match-data around body.
matlab-up-string-orocomment, and matlab-backward-up-string-or-comment - Return t if we moved.
matlab-move-list-sexp-internal - skip whitespace before moving, and do
special stuff we we start in a string or comment, but are at the beginning/end of it.
matlab-backward-sexp - fix some cases with 'noerror' feature.
matlab-lattr-block-close - Fix to skip over ends in comments, strings and other places
while still counting ends that are valid.
matlab-show-paren-or-block - Fix case when on end to ignore ends that are array indices,
and use 'noerro' intput to matlab-backward-sexp.
2019-10-02 23:03:30 -04:00
Eric Ludlam
6e1a7fc784 Fix name of a test function.
Fix test in -regexp-opt replacement where I was previously negative testing if it didn't exist.
2019-09-30 20:48:29 -04:00
Eric Ludlam
84edff1c50 Add details of changes to support strings and other improvements. 2019-09-30 20:47:26 -04:00
Eric Ludlam
53a028e09f Added several more examples to test navigation with.
Deleted class stuff from expressions.m.  That is now in mclass.m.
Added attributes and type values to class to test font locking.
2019-09-29 19:31:31 -04:00
Eric Ludlam
318404cada Refactor how MATLAB mode handles font-locking:
* Support special classdef syntaxes, including class name highlight,
  class, property, and method block attribute highlighting, property
  variable name highlighting and property variable data-type
  highlighting.

* Create matlab mode specific version of regexp-opt so users can
  customize keyword lists in any Emacs version.

* Converted the simulink symbols, and constant symbols (like pi) into
  lists that can be configured.

Tweaks:
* Simulink symbols are always highlighted.  Removed configuration
  variable to disable.

* matlab-gaudy-font-lock-keywords is now built from 3 other variables,
  making maintenance a little easier.

* set font-lock-multiline to 'undecided.  This fixes block comments,
  unreachable code, and enables property block var highlighting so
  they work when editing inside the block.

* Added "autostart" option to matlab-forward-sexp to aid in font-locking
  blocks.  This will move until a block the cursor is in is exited.
2019-09-29 19:30:01 -04:00
Eric Ludlam
d685f31c54 Add tests that verify more expressions, including those needed by show-paren-mode.
Tests the underlying function, not the show paren mode support.
2019-09-28 22:33:09 -04:00
Eric Ludlam
9d3803e3d5 Add matlab-show-paren-or-block, an implementation for show-paren-mode.
Correctly highlights parens even when there are other parens in strings and comments.
In mode, init paren-mode with this fcn.  Disable older block highlighter.
2019-09-28 22:32:23 -04:00
Eric Ludlam
6a06906b2d Add tests to check sexp navigation with expressions.m, and new functions in metest.el.
Update strings.m to include strings with parens and brackets in them, also in cell arrays.
2019-09-26 21:42:55 -04:00
Eric Ludlam
ff70f3e933 Font-lock funtion for strings and comments - Add elipsis to the list of matchable things.
Remove elipsis highliter from gaudy font lock elements.
Add matlab-up-string-or-comment, and matlab-backward-up-string-or-comment.
Add matlab-move-list-sexp-internal for navigating lists
Add matlab-move-simple-sexp-internal for navigating simple sexp expressions like comments, strings, and lists.
Update matlab-backward-sexp and matlab-forward-sexp replace emacs sexp navigation with above simple-sexp naviation functions.
Update matlb-cursor-comment-string-context to also return bounds to be used for navigating strings and comments.
2019-09-26 21:41:30 -04:00
Eric Ludlam
e8776961b3 Instrument with test cookies for metest.el to search for. 2019-09-23 21:51:58 -04:00
Eric Ludlam
8193333f37 Simple bash script for running matlab-emacs tests in batch mode. 2019-09-23 21:50:28 -04:00
Eric Ludlam
83a7a4a8f4 Matlab emacs test suite.
Start with strings test.
2019-09-23 21:50:04 -04:00