Commit graph

67 commits

Author SHA1 Message Date
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
Eric Ludlam 68a56a486e matlab-shell.el:
(matlab-shell-wrapper-filter): Make sure we are in the *MATLAB* buffer
when checking and running prompt hooks.
(matlab-shell-run-region): Change how display-buffer is called
to better re-use frames and windows if they are showing.
2019-11-26 10:49:29 -05:00
Eric Ludlam 023f653c4a matlab-shell.el:
Update how filters are setup and run, and move where prompt-appears-hook is created.
Setup several new prompt-appears hook fcns for initializing the process instead of comint filter fcns.
Improve how errors are scanned.
(matlab-shell-errorscanning-syntx-table): New syntax table where \n is whitespace.
(matlab-shell-prompt-hook-cookie): New, used to pass prompt appear status.
(matlab-shell-suppress-prompt-hooks): New
(matlab-shell-cco-testing): New
(matlab-shell-mode): Move our comint hooks to be local.
Add new prompt-appear-hook to a first-prompt-fcn, and also for render-errors-as-anchor.
(matlab-shell): Remove GUD process filter and sentinel.
Add our own matlab-shell-wrapper-* filter and sentinel.
(matlab-shell-wrpper-filter): New.
Calls out to GUD, and calls matlab-shell-prompt-appears-hook when
matlab-shell-prompt-hook-cookie is true.
(matlab-shell-wrapper-sentinel): New.
(matlab-shell-render-html-anchor):
Use matlab-shell-errorscanning-syntax-table.
(matlab-shell-error-anchor-expression, matlab-shell-error-location-expression):
Update spaces to be \s- to overcome newlines.
(matlab-shell-scan-for-error): Use errorscanning syntax table.
(matlab-shell-render-errors-as-anchor): Minor comment/doc cleanup.
Put full file in help-echo.
(matlab-shell-first-prompt-fcn, matlab-shell-user-startup-fcn): NEW
Contents was from `gud-matlab-marker-filter'.  Setup matlab for first
time by running emacsinit, and user's init code.
(matlab-shell-second-prompt-fcn): New.  Set's prompt-seen.
(gud-matlab-marker-filter): Remove emacsinit setup for MATLAB, and other content
that moved to matlab-shell-first-prompt-fcn.
Turn off beeps.
Stop running matlab-shell-prompt-appears-hook, and instead just set the cookie.
(matlab-shell-collect-command-output): suppress prompt hooks.
Enable timeouts if we wait too long.
(matlab-shell-mref-which-fcn): Disable when cco testing.
(matlab-find-other-window-file-line-column): Stop using goto-line (as per doc)
and use forward line isntead.  Cleans up spurious 'set mark' text during test.
2019-11-25 23:31:59 -05:00
Eric Ludlam 1bf1229a46 matlab-shell.el:
Enable testing harness, and MATLAB running under a pipe insted of pty.
(matlab-shell-render-errors-as-anchor): Make sure that the
full file (from the mref expander) succeeds before using it.
(matlab-shell-matlabroot-run): New variable.
(matlab-shell-matlabroot): Use cache
(matlab-shell-collect-command-output): Enable when using pipe
instead of pty.  In this case the process doesn't echo, so
we compute bounds of result differently.
Use computations instead of movement to id bounds of captured output.
(matlab-shell-mref-which-fcn): Wrapper around `matlab-shell-mref-which-fcn'
to prevent errors.  (ie - allow it to just return nil).
(matlab-shell-mref-converters): Use above.
2019-11-24 23:20:42 -05:00
Eric Ludlam 21039bea58 matlab-shell.el:
(matlab-shell-which-fcn): Force point to end-of-buffer
before testing the prompt and running commands.
2019-11-24 20:36:15 -05:00
Eric Ludlam 39e2480009 matlab-shell.el:
Minor improvements that enable testing.
(matlab-shell-send-command): Make sure to run in the matlab-shell
buffer.
2019-11-24 20:28:08 -05:00
Eric Ludlam e703abcdcb matlab-shell.el:
Make finding errors more robust.
(matlab-shell-render-errors-as-anchor):
Compute actual full file here, and store on the URL instead of using
the matlab reference name.
2019-11-24 15:54:34 -05:00
Eric Ludlam 9b04e0b359 matlab-shell.el:
Improve behavior of return key in this preceeding history text of the shell.
(matlab-shell-mode):
Set comint-get-old-input to below.
(matlab-comint-get-old-input): New.
Only return text to evauate if it was on a prompt before.
2019-11-23 22:04:04 -05:00
Eric Ludlam c200c243b4 matlab-shell.el:
(matlab-find-other-window-file-line-column):
If input file fails to translate into a file name, issue a descriptive
error instead of passing nil to find-file-other-window.
2019-11-23 21:10:40 -05:00
Eric Ludlam 260d811f03 matlab-shell.el:
Improve error highlighting.
(matlab-shell-render-errors-as-anchor): Fix scanning for the first error
in a session.
(matlab-shell-class-mref-to-file): Add fcn-p flag.
When t, convert to a function name in a package.
(matlab-shell-mref-converters): Add expression to
match functions in a package.

tests/+eltest/+utils/testme.m:
New function in a package that throws an error.
2019-11-23 20:23:32 -05:00
Eric Ludlam 76a5415dee matlab-shell.el:
Turn off netshell integration by default until it is more stable.
2019-11-23 17:34:25 -05:00
Eric Ludlam 3e393c3838 matlab-shell.el
Fix byte-compiler warning, add forward decl matlab-netshell-server-active-p.
2019-11-23 09:34:01 -05:00
Eric Ludlam 1104cbf069 matlab-shell.el
Initialize netshell on regular shell startup based on config.
(matlab-shell): Fix netshell server start (don't do it twice.)
(matlab-shell-render-errors-as-anchor): Fix bug if no errors in shell yet.
(gud-matlab-marker-filter): When sending emacsinit command,
also send netshell start command if configured to do so.
2019-11-23 09:32:49 -05:00
Eric Ludlam d6a2d5f8d4 matlab-netshell.el
Improve command parsing / error handling.
(matlab-netshell-client): New helper.
(matlab-netshell-execute-command): Handle new commands
output, and error.
(matlab-netshell-eval): Designed for sending an eval command
(matlab-netshell-evalc): Designed for sending an evalc command

matlab-shell.el:
Integrate netshell support.
(matlab-shell-autostart-netshell): New option.
(matlab-netshell-active-p, matlab-any-shell-active-p): New
(matlab-shell-send-command): New wrapper around send-string
or netshell command send.
(matlab-shell-save-and-go): Integrate matlab-netshell.
Improve finding if we need to CD somewhere.
Use 'run' to run things not on the path.
Select between netshell or regular shell.
(matlab-shell-run-region): If netshell is available, use it
to send region to MATLAB.

matlab.el:
Fix menus that need a shell.
(matlab-frame-init): For commands that need a shell, now use
`matlab-any-shell-active-p'.
2019-11-23 08:58:46 -05:00
Eric Ludlam 931bcb5422 matlab-shell.el:
(matlab-shell-html-map): Add mouse-1 as a valid click to active an anchor.
2019-11-21 16:44:56 -05:00
Eric Ludlam 391bd8a57f matlab-shell.el:
Fixup error parsing and file finding to support classes.
(matlab-shell-render-errors-as-anchor):
Fix how last-anchor is tracked.
(matlab-shell-class-mref-to-file):
New converter.  Takes package.class/method and converts to the
file +package/@class/class.m
(matlab-shell-mref-converters): Add above.
2019-11-21 16:31:23 -05:00
Eric Ludlam 003a503dd7 Merge branch 'modernize' of ssh://git.code.sf.net/p/matlab-emacs/src into modernize 2019-11-20 21:57:45 -05:00
Eric Ludlam 2f9d83016e matlab-shell.el:
(matlab-shell-error-location-expression):
Improve syntax for error regexp.
2019-11-20 21:57:28 -05:00