Commit graph

31 commits

Author SHA1 Message Date
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
Eric Ludlam e843d73699 matlab-shell.el
New way for running regions.
(matlab-shell-region-command):
Use new command below if buffer has a file.
(matlab-shell-run-region-internal):
New way to run a region by using helper M file below.

emacsrunregion.m
(emacsrunregion): New function that runs a region from a file in MTLAB.
2019-11-20 21:32:42 -05:00
Eric Ludlam da21c4789f matlab-shell.el:
(matlab-shell-error-location-expression):
Fix error expressions to handle directories w/ + in them.
(matlab-shell-scan-for-error-test):
New command for testing.
(matlab-shell-scan-for-error):
Strip out interactive bits.

errexamples.shell.m:
Fixed location of some of the errors.
2019-11-19 12:58:14 -05:00
Eric Ludlam b26c55026a matlab-shell.el:
Always start an emacsclient server.
(matlab-shell--get-emacsclient-command):
Create a server for matlab-shell's use independent of
any other emacsclient.
2019-11-19 08:49:21 -05:00
Eric Ludlam 0df34411c5 matlab.el, matlab-shell.el:
Remove eei / emacslink references.
Add debug commands to menu.
(matlab-save-and-go, matlab-shell-run-region):
Remove emacslink logic.
(matlab-use-eei): Delete.
(matlab-mode-menu): Add enable logic to anything
that depends on matlab-shell being active.
Add debugging items to menu.
2019-11-18 16:10:56 -05:00
Eric Ludlam 623f7ba1f7 matlab-shell.el:
Patch from John Ciolfi.
Fix some of the gud toolbar buttons, and make edit cmd work better.
(server): New Require
(matlab-shell-mode): Revised gud bindings.
(matlab-shell--get-emacsclient-command): New
(gud-matlab-marker-filter): Use above.
2019-11-18 09:58:49 -05:00
Eric Ludlam cb10deea2c matlab-shell.el:
Autoload cookie for `matlab-mode-determine-matlabroot'.
mlint.el:
More robust finding of mlint program.
(mlint-reset-program): If other tricks fail,
use matlabroot and find mlint that way.
2019-11-17 16:19:42 -05:00
Eric Ludlam a1dd9078f2 matlab-shell.el
Fix error and warning scraping and jumping.
Delete some obsolete text formatters.
(matlab-shell-mode): Re-enable comint filter function
`matlab-shell-render-errors-as-anchor'.
(matlab-txt-format-beg, matlab-txt-format-end): Delete.
(matlab-shell-render-html-txt-format): Delete
(gud-matlab-error-regexp): Deleted.  Expressions are now in the below:
(matlab-shell-error-anchor-expression): New
(matlab-shell-error-location-expression): New
(matlab-shell-scan-for-error): New, uses above to find
errors, and return file and line number info.
(matlab-shell-render-errors-as-anchor): Use above.
Make input optional to simplify testing.
(matlab-shell-which-fcn): Fix preceeding comments.
This is now used by below.
(matlab-shell-mref-converters): New
(matlab-shell-mref-to-filename): New, use above.
Converts a file name (as scraped from MATLAB output)
into a file name emacs can use.
Will now ask MATLAB to get a file name if it can't figure it
out on it's own.
(matlab-find-other-window-file-line-column): Use above
instead of ad-hoc soln.
(matlab-shell-last-error): Use new `matlab-shell-scan-for-error'.
2019-11-17 16:01:07 -05:00
Eric Ludlam e8560db539 matlab-shell.el:
Revamp basic completion in the shell.
(company-mode,company-idle-delay): Quiet compiler.
(matlab-shell-mode-map): Remove random checks about `company-mode'.
Always provide the same bindings and control how to complete elsewhere.
Add comments and group keybindings.
Remove extras - only provide one complete.
(matlab-shell-tab): Convert to a switchyard.
Use `cond' to break up function into clear sections for each type of
completion we can do.
(matlab-shell-do-completion-light): New.
Uses `completion-in-region' to do all the work.
(matlab-shell-do-completion) New, all code that used to be in
`matlab-shell-tab'.  To be used by older versions of Emacs.
2019-11-17 10:30:43 -05:00
Eric Ludlam 5c67bdb31b matlab-shell.el:
Trim out old XEmacs logo thing.
Cleanup some completion stuff.
(matlab-shell-logo): Delete.
(matlab-shell-mode): Don't setup xemacs logo hack.
(matlab-shell-hack-logo): Delete

(matlab-shell-ask-MATLAB-for-completions): Move.
(matlab-shell-tab-company-available): Compute
default value inline.
(matlab-shell): Set companyidle delay to nil
to prevent random popups from appearing as you type.
(matlab-shell-window-exists-for-display-completion-flag): Delete.
(matlab-shell-get-completion-info): Update the doc
to conform to standards.
(matlab-display-completion-list): Moved to matlab-compat.el
(matlab-shell-tab): Cleanup old window display code to
use `display-buffer' instead.
(matlab-tab-hide-completions): Replace complexity with
`quit-buffer'.
2019-11-17 08:41:02 -05:00
Eric Ludlam 0edda7ad1f matlab-compat.el:
(matlab-set-keymap-parent): New shim fcn.
(matlab-find-executible-directory): New fcn.
matlab-shell.el:
Use matlab-compat.el.
Always require comint, as this file won't load unless someone
is trying to create a shell.
(matlab-shell-font-lock-keywords): Refresh
to highlight startup text again.
(matlab-mode-determine-matlabroot): New.
(matlab-mode-install-path): Use above.
(matlab-mode-determine-mfile-path): Delete.
(matlab-shell-mode-map): Create during declaration,
including the menus.
(matlab-shell-mode): Don't make menu (see above)
(matlab-shell): Don't make keymap (see above)
semantic-matlab.el:
(semantic-matlab-root-directory): delete
(semantic-matlab-root-directory): Use
matlab-mode-determine-matlabroot instead of above.
2019-11-16 15:59:56 -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 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 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 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 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 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