Commit Graph

84 Commits

Author SHA1 Message Date
John Ciolfi 3048e9fdf4 fix matlab-shell dbstack first entry hyperlink
Given:
    function foo()
        bar()
    end

    function bar()
        goo()
    end

    function goo()
        keyboard
    end
In matlab-shell, the first stack entry is now hyperlinked:
    >> foo
    K>>  dbstack
    > In foo>goo (line 10)
    In foo>bar (line 6)
    In foo (line 2)
    K>>

Also fixed a couple typos.
2023-04-26 18:16:49 -04:00
John Ciolfi 45febb409c Fix conflict between matlab-shell debugging and C++ (or other language) debugging.
Fix conflict between matlab-shell debugging and C++ (or other language) debugging.
- matlab-shell debugging previously leveraged gud.el for debugging of *.m files.
- C++ debugging also leverages gud.el for debugging.
- Only one instance of a gud.el debugger can be active. If you run two, say
  *.m debugging and C++ debugging. Then you get odd errors such as the
  ebbreak not being recognized by gdb.
To fix these issue, I copied gud.el and made a new namespace "mlgud". I also
removed a lot of unused code from mlgud.el, though there's still more that can
be removed. Now one can debug *.m files and *.cpp files in one Emacs session.
2022-03-11 14:55:04 -05:00
Uwe Brauer c25894b912 Apply patch provided by Karthik Chikmagalur (matlab-shell)
* matlab-shell.el (matlab-shell-region->script): 676 apply patch provided by  Karthik Chikmagalur <karthikchikmagalur@gmail.com>: Copy all local functions to script.
2021-07-26 10:58:42 +02:00
Eric Ludlam 3b21236546 matlab-shell.el:
(matlab-shell-font-lock-keywords, matlab-shell-object-output-font-lock-keywords):
Move a few extra things out of base keywords and into next level keywords.
2021-03-30 20:52:15 -04:00
Eric Ludlam 859b7fde44 matlab.el:
(matlab-ltype-empty, matlab-ltype-comm): DELETE
(matlab-ltype-continued-comm): Rename to
(matlab-line-continued-comment)
(matlab-lattr-block-open): Rename to
(matlab-line-count-open-blocks)
(matlablattr-block-close): Rename to
(matlab-line-count-closed-blocks)
(matlab-calculate-indentation-1): Use new names.
(matlab-next-line-indentation): Use new names.
(matlab-comment-return): Simplify.
(matlab-comm-from-prev): New
(matlab-electric-comment): Simplify
(matlab-comment): Use new apis.
Simpilfy.
(matlab-set-comm-fill-prefix, matlab-find-convenient-line-break)
(matlab-fill-paragraph, matlab-mode-vf-functionname)
(matlab-mode-vf-classname, matlab-show-line-info)
Use new api

matlab-cgen.el:
(matlab-insert-end-block, matlab-insert-next-case):
Use new api for finding empty lines.

matlab-complete.el:
(matlab-lattr-semantics):
Use new api for finding empty lines.

matlab-shell.el:
(matlab-shell-run-cell):
Use new api for finding comment lines.
2021-03-23 20:29:55 -04:00
Eric Ludlam 196843b0ed matlab-shell.el:
(matlab-shell-save-and-go): Enable parameters to be sent through emacsrun.

toolbox/emacsrun.m:
Accepts the args as a string, and build up the command to run.
2021-03-22 21:32:59 -04:00
Eric Ludlam 9ff2d09342 matlab-scan.el:
(matlab-end-of-comment-point): New
(matlab-line-code-p): Fix doc.
(matlab-line-boring-code-p): New
(matlab-line-end-of-code): New defubst
(matlab-line-end-of-code-needs-semicolon-p): New

matlab-shell:
(matlab-read-line-at-point): replace cmd grab with
simpler new version.
(matlab-shell-run-cell): Stop using obsolete input to matlab-end-of-command.

matlab.el:
(matlab-region-face): Get rid of old compatibility code.
(matlab-function-font-lock-keywords): Use new end-of-command fcn.
(matlab-beginning-of-command): Delete old impl, use new only.
(matlab-lattr-implied-continuation)
(matlab-prev-line-cont, matlab-lattr-array-cont)
(matlb-lattr-array-end, matlab-lattr-middle-block-cont)
(matlab-lattr-endless-block-cont, matlab-lattr-local-end): DELETE
(matlab-comment-on-line): Simpler new implementation
(matlab-calculate-indentation-1): Replace some old calls with
new versions.
(matlab-indent-end-before-ret): Replace regex w/ new keyword
handler.
(matlab-semicolon-on-return): Replace impl w/ new semicolon api
(matlab-fill-paragraph): Replace old api calls w/ new.
(matlab-mode-vf-quiesce-buffer): Replace lots of old parsing code
with simple calls from new api.
2021-03-20 16:34:34 -04:00
Eric Ludlam e437a87761 matlab-shell.el:
(matlab-shell-save-and-go): Use 'emacsrun' insteaad of 'run'.
toolbox/emacsrun.m:
New file.  Calls clear on the m file before running it.
Used in matlab-shell-save-and-go.
2021-02-27 13:59:22 -05:00
Eric Ludlam 3fd09f43f5 Separate font-lock keywords that are only for M files, and those that
work fine for files and the shell.
matlab.el:
(matlab*-font-lock-keywords): Use defconst.
(matlab-font-lock-keywords): Rename to:
(matlab-basic-font-lock-keywords): New
and remove lines to:
(matlab-file-basic-font-lock-keywords): New.
(matlab-gaudy-font-lock-keywords): Rename to:
(matlab-file-gaudy-font-lock-keywords): New
and only use keywords for -file- and both.
(matlab-mode): Use new named keywords.

matlab-shell.el:
(matlab*-font-lock-keywords): Use defconst.
Use only keywords from matlab.el meant for both files and shell.
(matlab-shell-object-output-font-lock-keywords): New
2021-02-27 11:41:29 -05:00
Eric Ludlam f9c32289db matlab-shell.el:
(matlab-shell-save-and-go): Use `matlab-shell-send-command' so that
it works with netshell as well as regular shell.
2020-02-08 21:42:19 -05:00
Eric Ludlam 59e245e543 matlab-shell.el:
Add ability to specify which command save-and-go uses instead of current buffer.
Useful when multiple files contribute to a particular program you want to run.
(matlab-shell-save-and-go-command, matlab-shell-save-and-go-command-enabled):
New options
(matlab-shell-set-save-and-go-command): New command.
(matlab-shell-save-and-go): Check above new options.
If it has a value, check if it is safe to use tht command.
If not, do the default.
2019-12-27 18:15:25 -05:00
Eric Ludlam b5f51beaed matlab-shell.el:
(matlab-shell-save-and-go): When asked to cd to file directory,
make sure the shell is not in that directory before issuing CD command.
Use `emacscd' command, to make sure Emacs' matlab-shell buffer also
changes.
2019-12-27 17:13:49 -05:00
Eric Ludlam 462c6d2a1e matlab-maint.el:
Setup to simplify which Emacs to compile with.
(matlab-maint-menu): Add "clean" and "pick emacs" items.
(matlab-maint-compile-opts, matlab-maint-compile-emacs): New options.
(matlab-maint-pick-emacs, matlab-maint-compile-clean): New commands.
(matlab-maint-compile-matlab-emacs): Use `matlab-maint-compile-emacs'
as the value to EMACS variable in compile call.

linemark.el:
Use find-file-hook (find-file-hooks is obsololete)

matlab-shell.el:
Setup declared fcn for `matlab-shell-help-mode'.

matlab.el:
(matlab-mode): Use write-contents-functions instead of
write-contents-hooks.
(gud-matlab-debug-active): Give forwrad declare a value of nil.

mlint.el:
Require 'font-lock' during compilation.
(mlint-clear-cross-function-variable-highlighting):
Extra checks for `font-lock-flush' before calling.
2019-12-22 17:01:38 -05:00
Eric Ludlam 852544094b matlab-shell.el:
(matlab-shell-mode-map): Add C-c C-c binding to matlab-shell-interrupt-subjob.
(matlab-shell-flush-accumulation-buffer): New state variable.
(matlab-shell-wrapper-filter): If above variable is non nil, flush
the accumulation buffer as if there were no emacscap tags.
(matlab-shell-interrupt-subjob): New command.
Sets state to flush accumulation buffer, and also sends interrupt signal.
2019-12-20 22:14:52 -05:00
Eric Ludlam ba3e1bb3ca matlab-shell.el:
(matlab-shell-accumulator): Make buffer local.
(matlab-shell-process-capture-text):
MATLAB Help buffers now can appear as prefix, not whole buff name.
Detect those.
Improve display-buffer so we can re-use windows.
2019-12-20 21:22:20 -05:00
Eric Ludlam 6d20f0f89f matlab-shell.el:
(matlab-shell-run-region-cmd): Delete, replace with...
(matlab-shell-internal-emacsrunregion): New variable specifies
what MATLAB command to use to run a region.
(matlab-shell-run-region-command): Renamed to ...
(matlab-shell-run-region-function): is now a lisp function symbol
to use to run the region, but uses the same text tags.
Cross ref the above variables.
(matlab-shell-region-command): Use new variable name from above.
If not 'auto' then just 'funcall' the region function.
(matlab-shell-run-region-internal): Renamed to ...
(matlab-shell-region->internal): New name.
Use new internal-emacsrunregion variable.
(matlab-shell-extract-region-to-tmp-file): Rename to ...
(matlab-shell-region->script): new name.
2019-12-19 16:36:22 -05:00
Eric Ludlam d4cf28da08 matlab-shell.el:
(matlab-shell-capture-text): Deleted.
(matlab-shell): Remove ref to above.
(matlab-shell-wrapper-filter): Prevent text between <EMACSCAP> from
being displayed into the comint buffer.  Instead, dispatch to below.
(matlab-shell-process-capture-text): New.
Process text string that is expected to have entire content
between <EMACSCAP> tokens.  Replaces `emacs-shell-capture-text'.
2019-12-19 07:05:03 -05:00
Eric Ludlam 8ef81d040a matlab-shell.el:
Fix misc typos across the file.
(matlab-shell-sync-buffer-directory): New command.
(matlab-frame-init, matlab-shell-mode-map): Add bindings for above.
2019-12-18 14:09:22 -05:00
Eric Ludlam cbdb3bf821 matlab-shell.el:
(matlab-shell-history-ignore): New customizable variable.
(matlab-shell-version-scrape): Update version regex to include prerelease.
Add config for `comint-input-history-ignore' to ignore stuff
sent by Emacs to ML.
2019-12-17 20:04:38 -05:00
Eric Ludlam b284f9a8b5 matlab-shell.el:
(matlab-shell-version-scrape): Change where we remove ourselves from
comint-filter-functions to avoid any leftovers if there is an error.
(matlab-shell-capture-text): Fix error msg when evaluating forms.
Used wrong variable previously.
2019-12-17 17:26:25 -05:00
Eric Ludlam 1b8414d946 matlab-shell.el:
(matlab-shell-capture-text): Move the evaluation of forms,
or the display of the help buffer outside the
outermost save-excursion.  This allows these commands to reposition
point in different buffers.
2019-12-16 19:30:08 -05:00
Eric Ludlam 6e2f2a844f matlab-shell.el:
(matlab-shell-startup-command): Use defcustom instead of
defvar.
(matlab-shell-run-region-cmd): New
(matlab-shell-run-region-internal): Use above for cmd instead
of hard coded value.
2019-12-14 21:17:18 -05:00
Eric Ludlam e28a218328 matlab-shell.el:
(matlab-shell-capture-text): Improve error message
so text can be used with eval.
2019-12-14 18:46:02 -05:00
Eric Ludlam 9ddd83f554 matlab-shell.el:
(matlab-shell-wrapper-filter): Try to hide EMACSCAP text
in case it takes a while to display.
2019-12-14 11:52:22 -05:00
Eric Ludlam 85d373314c matlab-shell.el:
(matlab-shell-render-errors-as-anchor): Move to end of buffer
before scanning for errors a new time.
2019-12-13 09:07:31 -05:00
Eric Ludlam 2e8905b59d matlab-shell.el:
(matlab-shell-scan-for-error): Some errors might
be indented, so don't underline the spaces in front.

tests/buggy.m:
Add example indented error.
2019-12-13 09:01:59 -05:00
Eric Ludlam 67f220ced2 matlab-shell.el:
Fix varous issues in doc strings and messages identified by `checkdoc'
command.
2019-12-12 22:18:55 -05:00
Eric Ludlam cbd71a0ff5 matlab-shell.el:
(matlab-shell-emacsclient-command): Change default to use
output from `matlab-find-emacsclient'.
(matlab-shell--get-emacsclient-command):
Add docstring.
Added windows capability - adding internal quotes to match
up with the quotes added by ML on windows.
2019-12-11 22:10:31 -05:00
Eric Ludlam 79435fbb72 matlab-shell.el:
(matlab-shell-run-region-command): New customization option.
(matlab-shell-region-command): Use above to determine how to run
the region.
2019-12-09 22:55:44 -05:00
Eric Ludlam a0d12a597b matlab-shell.el:
(matlab-shell-first-prompt-fcn): Call emacsinit with 'run'.
Emacsinit will now set the path and rehash.
Use emacs.set for setting up other features.

toolbox/emacsinit.m:
Take no inputs - need to be used via `run'.
Remove stuff now in toolbox/+emacs/set.m for setting up emacsclient.
Remove stuff related to inputs.  Only create netshell if not in Emacs.
2019-12-09 22:38:38 -05:00
Eric Ludlam 59b326edd6 matlab-shell.el:
(matlab-shell-render-errors-as-anchor): Use `matlab-string-trim' instead
of `string-trim' for compat w/ older emacsen.
2019-12-08 12:30:17 -05:00
Eric Ludlam e2b6dbe997 matlab-shell.el:
(matlab-shell-error-anchor-expressions): Update to also deal with
output from dbup/down "workspace belonging to" flavor text.
(matlab-shell-render-errors-as-anchor): Trim file name string.
(matlab-shell-capture-text): Protect when running forms from MATLAB.
2019-12-08 11:55:24 -05:00
Eric Ludlam 34b192db4c matlab-shell.el:
(matlab-shell-error-face): Give this face a customization group.
2019-12-07 19:33:07 -05:00
Eric Ludlam 19a0d5fc59 matlab-shell.el:
Allow spaces in front of Error text.
Needed for Errors that are captured, and posted later indented.
(matlab-shell-error-anchor-expression):
Allow spaces in front of error anchor.
2019-12-07 12:18:11 -05:00
Eric Ludlam 351bfbb62d matlab-shell.el:
Improve performance of processing massive error stacks.
(matlab-shell-in-process-filter): New state variable.
(matlab-shell-wrapper-filter): Bind above to t inside body of filter.
(matlab-shell-mref-which-fcn): Do not process file names if in a process filter.
2019-12-03 13:24:13 -05:00
Eric Ludlam d16934c6a0 matlab-shell.el:
Allow MATLAB to tell Emacs what to do.
(matlab-shell-capture-text): After capture, if buffername has special value 'eval'
then read the forms, and evaluate them instead of pushing into a buffer.
2019-12-01 20:11:52 -05:00
Eric Ludlam 5eca9d83a0 matlab-shell.el:
(matlab-shell-version-scrape): Support 18b version numbers too.
2019-11-29 22:24:36 -05:00
Eric Ludlam 8c4edbb52a matlab.el:
(matlab-help-map, matlab-frame-init):
Remove references to topic browsers.

matlab-shell.el:
(easy-menu-define, matlab-shell-mode):
Remove references to topic browsers.
(matlab-shell): Add capture text to prompt-appears hook.
(matlab-shell-capturetext-*-text): New regexp
(matlab-shell-capture-text): New filter fcn that captures
anything between start/end and shows in a buffer.
(matlab-shell-describe-command): Add -emacs flag when calling help.

matlab-topic.el:
Remove topic browsing mode.
(matlab-shell-topic-mode-hook, matlab-shell-topic-current-topic)
(matlab-shell-topic-browser, matlab-shell-topic-mode-menu)
(matlab-shell-topic-mode, matlab-shell-topic-mode-menu)
(matlab-shell-topic-browser-create-contents):
Delete
(matlab-shell-topic-click -> matlab-shell-help-click): rename
(matlab-shell-topic-choose -> matlab-shell-help-choose): rename
(matlab-shell-topic-mouse-highlight-subtopics ->
 matlab-shell-help-mouse-highlight-subtopics): Rename
 (matlab-shell-help-choose): downcase found text, always
 use *-describe-command.

toolbox/help.m:
New function to shadow system help.
Wrap output of system help in capture text cookies.
2019-11-29 15:49:38 -05:00
Eric Ludlam 5eadc5155a matlab-shell.el:
(matlab-shell-version-scrape): Add 2nd attempt to find versions.
Leave old regex there for older MATLABS.
Print something when we succeed.
2019-11-29 11:48:52 -05:00
Eric Ludlam 5babf99f26 matlab-shell.el:
(matlab-shell): Fixup TODO comment
2019-11-29 08:47:33 -05:00
Eric Ludlam 2f3f3fe9e5 matlab-shell.el:
(matlab-shell-second-prompt-fcn): Fix to remove the correct hook.
2019-11-28 20:26:35 -05:00
Eric Ludlam 4184aec9f4 matlab-shell.el:
Factor out matlab-shell-gud.el -> gud support is seperate.
Move stuff around so things make a little more sense.
(matlab-shell-enable-gud-flag): Remove. Always enable.
(matlab-shell-mode, matlab-shell): Move content between these
two functions.  Keep settings and keybindings in the mode,
move filters and such in matlab-shell.
Delete gud content, call to matlab-shell-gud-* fcns instead.
Stop asking to use gud, just do it.
(matlab-shell-wrapper-filter): Adopt the garbage filter from
the gud filter.
Always call gud-filter.
(matlab-shell-wrapper-sentinel): Always call gud-sentinel.
Make sure buffer is set correctly.
(gud-matlab-*): Move to matlab-shell-gud.el
2019-11-28 18:19:10 -05:00
Eric Ludlam ca9701adf9 matlab-cgen.el matlab-complete.el matlab-netshell.el
matlab-shell.el matlab-topic.el srecode-matlab.el:
Fix email @ top of files to be real.
2019-11-28 15:56:59 -05:00
Eric Ludlam 2bcf58eb31 matlab.el, matlab-compat.el, matlab-complete.el, matlab-shell.el:
Fix matlab-shell-locate-fcn and fix spelling errors.

matlab-shell.el:
(matlab-shell-mode-map): Change C-c. keybinding to do matlab-shell-locate-fcn.
(matlab-shell-locate-fcn): New.

(matlab-find-file-under-path, matlab-find-file-on-path):
Deleted.

matlab.el:
(matlab-mode-map): Change binding of C-c. to do matlab-shell-locate-fcn
(matlab-frame-init): Change menu binding as with keybinding above.
2019-11-28 11:06:04 -05:00
Eric Ludlam f9f7e62367 matlab-shell.el:
(matlab-shell-run-region-internal): Reduce end by 1 char to match
how MATLAB does indexing of regions.
Check for DOS encoded files.  If it is, add charts to start & end to match
the number of CRs.  (DOS files have CRLF endings, not just LF endings.)
2019-11-28 10:41:17 -05:00
Eric Ludlam c597c705eb matlab-shell.el:
(matlab-shell-which-fcn): Use disp to show output of which
so we avoid helpful comments in command use of which.
2019-11-27 16:35:17 -05:00
Eric Ludlam 794b6439b5 matlab-shell.el:
Add support for debugging & the test harness.
(matlab-shell-io-testing): New.
(gud-matlab-marker-filter): When sending dbhotlink
command, force an echo if the subprocess isn't echoeing.
Print IO state if io testing is on.
(matlab-on-empty-prompt-p): Force to shell buffer before test.
(matlab-on-debug-prompt-p): New (used in tests.)
(matlab-shell-send-string): message io if iotesting is on.
2019-11-27 14:33:24 -05:00
Eric Ludlam 7a16edc405 matlab-shell.el:
(matlab-shell-class-mref-to-file): First split input on >
to strip off local functions, then continue as before.
(matlab-shell-mref-to-filename): Operate only in the MATLAB shell buffer.
Convenience for debugging.

tests/mstest.el:
Add point for testme(true) - error in local fcn.
Fix some line numbers.

tests/+eltest/+utils/testme.m:
Add error in local fcn option.
2019-11-26 14:55:19 -05:00
Eric Ludlam 391f075113 matlab-shell.el:
(gud-matlab-marker-filter): Clean out some old cruft supporting antique MATLABs.
Streamline finding our debug pattern, and setting the frame.
2019-11-26 12:50:01 -05:00
Eric Ludlam 03b2213809 matlab-shell.el:
(matlab-shell-error-face): Face used to colorize errors in MATLAB shell.
(matlab-shell-mode): Add prompt hook to colorize errors.
(matlab-shell-errortext-start-text, matlab-shell-errortext-end-text): New.
(matlab-shell-colorize-errors): New.
Scans for errortext start/end tokens, and drops an overlay on them.
(gud-matlab-marker-filter): Scan for {^H and }^H tokens, and convert
to errotext tokens.  Comint finds these and erases them, but they
really indicate text distinct from other output text.
2019-11-26 11:47:05 -05:00