Commit graph

391 commits

Author SHA1 Message Date
Eric Ludlam 9646902e54 matlab-compat.el:
(matlab-find-emacsclient): Fix paren bug w/ cond statement.

matlab-netshell.el:
Declare functions from matlab-shell, nd matlab-shell-gud to quiet the
byte compiler.
2019-12-12 18:45:59 -05:00
Eric Ludlam 92c2ce2b9e toolbox/+emacs/@Emacsserver/EmacsServer.m
Add FollowStack option that can be turned on/off.
When on, get the Stack object, and update the stack.

toolbox/+emacs/@Stack/Stack.m
Trim off all the timer cb parts of the stack to get to
where the user code really is in the case of EmacsServer.
Fix file names on Windows to have Emacs friendly slashes.

toolbox/+emacs/set.m
Add 'followstack' option.
Sets FollowStack prop on the Server.
2019-12-12 17:28:22 -05:00
Eric Ludlam ae9a63e2f9 matlab-netshell.el:
(matlab-netshell-execute-command):
Enable gud bindings when a connection is made from MATLAB.
2019-12-12 17:23:29 -05:00
Eric Ludlam 9f8014d2b0 matlab-shell-gud.el:
(gud-matlab-find-file, mlg-stack-choose):
Remove "..file are the same.." type warings.
2019-12-12 17:22:53 -05:00
Eric Ludlam eb65f25032 toolbox/emacsnetshell.m:
Improve doc comments.
Fix togglining of 'sendinit' so we don't send the init command
twice on startup.
2019-12-12 12:37:50 -05:00
Eric Ludlam 5123a02865 +emacs/@Breakpoints/Breakpoints.m:
When sending file names to Emacs, fix Windows \ characters
so they don't act as escape charts in Emacxs.
2019-12-12 12:37:00 -05:00
Eric Ludlam 53ef458cdb Merge branch 'modernize' of ssh://git.code.sf.net/p/matlab-emacs/src into modernize 2019-12-11 22:11:54 -05:00
Eric Ludlam 14541a788a matlab-netshell.el:
(matlab-netshell-execute-command): On init, send
emacs client command so ML can send us files to edit.
2019-12-11 22:11:11 -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 b4cc9187ba matlab-compat.el:
(matlab-find-emacsclient): New compat command -
Used to find emacsclient on random platforms.
2019-12-11 22:03:21 -05:00
Eric Ludlam f4352eb763 matlab-shell-gud.el
(mlg-reset-breakpoints): Add autoload cookie.
Needed so netshell startup loads this library.
2019-12-11 22:02:41 -05:00
Eric Ludlam 9c588fd7c3 matlab.el:
(matlab-mode-map): Remove M-q binding to matlab-fill-paragraph
(matlab-mode): Set fill-paragraph-function to mtlab-fill-paragraph.
Lets us use built-in paragraph filler w/ matlab specialization.
2019-12-10 21:45:17 -05:00
Eric Ludlam 164b06c8ca matlab.el:
(matlab-indent-function-body): Fix customize choices.  Values
weren't supposed to be quoted in.
2019-12-09 22:59:49 -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 a8d1ad4a5b toolbox/+emacs/set.m
New command for setting Emacs related state, like the client command
or the netshell setup.
2019-12-09 22:36:26 -05:00
Eric Ludlam eed7a5c20c matlab-shell-gud.el:
Enable dbstack display and navigation feature.
(mlg-stack-frame): New class.
(mlg-stack-frame::mlg-print): New method
(mlg-stack, mlg-frame): New variables.
(mlg-set-stack, mlg-set-stack-frame): New commands run from ML.
(mlg-show-frame, mlg-refresh-stack-buffer)
(mlg-show-stack): New commands to setup and display the stack.
(mlg-stack-mode-map, mlg-stack-mode-syntax-table): New
(mlg-stack-mode): New mode.
(mlg-stack-next, mlg-stack-prev, mlg-stack-click)
(mlg-stack-choose): New mode commands.
2019-12-08 22:20:02 -05:00
Eric Ludlam 025d502d67 toolbox/emacsinit.m
Modify the path to include this toolbox directory if not already on the path.
If not running inside emacs directly, init the netshell interface.
Initialize the emacs.Stack feature.
2019-12-08 22:17:28 -05:00
Eric Ludlam e7f1f33466 matlab-maint.el:
(matlab-maint-toggle-logger-frame): Only show client log if
the client is connected.
2019-12-08 22:10:18 -05:00
Eric Ludlam 2de21e3a1e toolbox/ebstack.m:
New wrapper for dbstack, using emacs.Stack to send data to Emacs.
2019-12-08 22:07:56 -05:00
Eric Ludlam 9ba9c66032 toolbox/+emacs/@EmacsServer/EmacsServer.m:
(breakpoints): Remove unused property.
2019-12-08 22:06:24 -05:00
Eric Ludlam 003e54ef5b toolbox/+emacs/@Stack/Stack.m:
New class for managing the sending of stacks to Emacs.
2019-12-08 22:05:50 -05:00
Eric Ludlam 30bbf55ef5 tests/dbtester.m
Add a deeper set of local functions to test stack reporting.
2019-12-08 22:04:45 -05:00
Eric Ludlam c5ebe3267d matlab-maint.el:
(easy-menu-define): Add "Display Logger frame" menu item.
(matlab-maint-logger-frame): New variable
(matlab-maint-toggle-logger-frame): New command.
2019-12-08 14:03:46 -05:00
Eric Ludlam 9bca22a465 matlab-compat.el:
New compat macros for cl-defmethod, pulse, and font-lock stuff.

linemark.el, mlint.el, matlab-shell-gud.el, semanticdb-matlab.el:
Replace defmethod with cl-defmethod.
Replace call-next-method with cl-call-next-method.

linemark.el:
Also require matlab-compat.el

tests/Makefile:
Allow EMACS to be overridable
2019-12-08 13:08:43 -05:00
Eric Ludlam bff15251f2 matlab-shell-gud.el:
Enable debug commands via netshell.
(matlab-at-fcn): New macro, dispatch to netshell if active.
(matlab-gud-fcn): Revise doc, it was wrong.
Use matlab-at-fcn internally.
(matlab-shell-mode-gud-enable-bindings): Use matlab-at-fcn for
dbstop/dbclear.
(gud-matlab-tooltip-tips): Fix bug for events from the shell
buffer, which seem to generate events with a window that has no
buffer.
2019-12-08 12:33:37 -05:00
Eric Ludlam aa0fa8e268 toolbox/emacsinit.m:
If netshell is being requested, capture it's object.
Initialize breakpoints with the netshell obj so it can
update via netshell if needed.
2019-12-08 12:31:21 -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 885eae827a matlab-compat.el:
(matlab-string-trim): New compatability shim.
`string-trim' introduced in newer emacsen.  This impl provides what is
needed for matlab-shell.
2019-12-08 12:29:40 -05:00
Eric Ludlam 42ecb1942d toolbox/+emacs/@EmacsServer/EmacsServer.m
(breakpoints): New property
(SendEval): New method to send an eval command.

(ExecuteRemoteCommand): Use evalin, not eval.
2019-12-08 12:17:33 -05:00
Eric Ludlam 4613f761ad toolbox/+emacs/@Breakpoints/Breakpoints.m
Support a netshell input.
When netshell is active, send breakpoints via the netshell connection.
Convert all disp commands to instead create a string
that can be sent via netshell.
2019-12-08 12:05:12 -05:00
Eric Ludlam 7b5cab6bee toolbox/emacsnetshell.m:
Fix so commands get sent as intended.
Enable output argument if provided.
2019-12-08 11:57:17 -05:00
Eric Ludlam 28f0116169 toolbox/ebclear., ebstop.m:
Fix function names to match file name.
2019-12-08 11:56:15 -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 154c4cab8b matlab-netshell.el:
(matlab-netshell-execute-command):
Support 'eval' command from MATLAB.
2019-12-08 11:49:26 -05:00
Eric Ludlam a6bcf575fa matlab-shell-gud.el:
Add support for visible breakpoints.
(matlab-shell-mode-gud-enable-bindings): Use ebstop,ebclear instead
of dbstop,dbclear.
(mlg-breakpoint): New class.
(matlab-gud-visible-breakpoints): New variable.
(mlg-reset-breakpoints, mlg-add-breakpoints, mlg-del-breakpoint): New.
Manage list of breakpoints.
On first add, add matlab-mode-hook to activate breakpoints when a
new ML buffer is pulled into a buffer.
(mlg-breakpoint-face): New face.
(mlg-breakpoint::mlg-activate): New method.
Creates an overlay at the loction of the breakpoint.
(mlg-breakpoint::mlg-deactivate)
(mlg-breakpoint-activate-buffer-opened-hook): New
(mlg-breakpoint-flush-and-reactivate): New command for debugging.

(matlab-shell-gud-minor-mode): Fix bug - want to make-local-variable,
not make it buffer local.
2019-12-07 19:41:49 -05:00
Eric Ludlam d14991310b toolbox/+emacs/@Breakpoints/Breakpoints.m:
New breakpoint tracking object.  Keep track of breakpoints
and send Emacs only the deltas.

toolbox/emacsinit.m:
Initialize breakpoint tracker.

toolbox/ebstop.m, toolbox/ebclear.m, toolbox/ebstatus.m:
New wrappers for dbstop, dbclear, and dbstatus.
Calls the built-in, and then calls the breakpoint tracker
to tell emacs about any changes in breakpoints.
2019-12-07 19:37:29 -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 d4dc0cce54 matlab-shell-gud.el:
Refine some of the debugging environment.
(matlab-shell-mode-gud-enable-bindings): Remove extra /
from stop/clear commands.
Don't provide a print.
(matlab-shell-gud-minor-mode-map): Add C-xC-q binding
to disable the minor mode.  (like e)
(matlab-shell-gud-menu): Change text for exiting the minor mode.
Add show symbol value option.
(define-minor-mode): Replace the gud toolbar with our own.
Disable toolbar with our mode.

matlab.el:
Re-enable debug mode if it is available.
(matlab-mode-map): Replace `toggle-read-only' with
a matlab version.
(matlab-toggle-read-only): New command.
If the debugger is active, turn on matlab-shell-gud-minor-mode.
Otherwise do read-only-mode.
2019-12-07 13:17:57 -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 b7dfa161f6 matlab.el:
More electric block comment behaviors.
(matlab-mode-map): Bind { to electric block comment.
(matlab-electric-block-comment): Auto-reindent block
comment start.  Useful when typing block comment after help
comments.
Add messages and highlighting for nested %{ and lonely %}.
2019-12-07 10:54:33 -05:00
Eric Ludlam 73dff40bfa tests/indents.el
Added more block comment patterns.
2019-12-07 10:24:31 -05:00
Eric Ludlam 6df971b0d2 matlab.el:
Electric block comment behaviors.
(matlab-mode-map): Bind } to electric block comment.
(matlab-mode): Add setting to after-change-functions
to `matlab-change-function' for clearing parsing caches.
(matlab-backward-sexp): Add special block-comment handler.
Convert to use (cond ...) instead of if.
(matlab-forward-sexp): Add block-comment handler
(matlab-change-function): New after-change-function which
flushes the block-comment cache.
(matlab-ltype-block-comm-bounds, -lastcompute): Moved.
(matlab-indent-line): Deleted a line of dead code.
(matlab-calculate-indentation-1): block comment body
lines that start with % now line up with the % in the
block comment start %{.
Replace uses of (current-column) with (current-indentation)
where appropriate.
(matlab-electric-block-comment): Auto-reindent block
comment end.
2019-12-07 10:19:37 -05:00
Eric Ludlam 1e6a2bbd38 indents.m:
Add wide range of additional tests.
This should have a mostly complete set of features
from matlab.el's indentation engine now.
2019-12-06 22:58:34 -05:00
Eric Ludlam d7fe4c5200 matlab.el:
Fany block comment indentation & performance changes.

When looking @ block comment indentation, discovered that
the block comment detector was called ALOT for indent of 1 line,
and then discovered beginning of command was also called a lot.

Added caching for block comment detection, and cut back on calls
to beginning of command.

(matlab-in-command-restriction): New
(matlab-with-current-command): New, uses above.
Create restriction by using matlab-beginning-of-command,
and be aware there is no need to re-restrict if we
detect we have recursed.
(matlab-valid-end-construct-p)
(matlab-lattr-block-close): Use above

(matlab-prev-line-cont): Extracted from matlab-beginning-of-command.
(matlab-beginning-of-command): Use above.
Call matlab-ltype-block-comm, if in block comment, go to
start of block comment. (new feature)

(matlab-ltype-comm-noblock): New, extracted from `matlab-ltype-comm'.
(matlab-ltype-comm): Use above.
Move block comments first, since sometimes they detect
as reg comments.
(matlab-ltype-help-comm): Change to return location of
function the help is for.
Use new ltype-comm-noblock to be faster.
(matlab-ltype-block-comm-bounds)
(matlab-ltype-block-comm-lastcompute): New caches.
(matlab-ltype-block-comm): Move body to matlab-ltype-block-comm-1.
This now handles caching, recycling old computations if
called more than once in same region.
Handles 'linebounds' input.
(matlab-ltype-block-comm-1): Fix bug where end of block comm
was always point-max.
Set bounds cache.
(matlab-ltype-block-comm-at-start): New
Use block comment cache.
(matlab-ltype-block-comm-at-end): New
Use block comment cache.
(matlab-ltype-continued-comm): Use ltype-comm-noblock.
(matlab-lattr-cont): Don't require % for comment after ...

(matlab-calculate-indentation-1):
Optimize finding beginning of defun by caching output
of matlab-ltype-help-comm.
Add new indentation parts for block comment start,end, and body.
For code lines don't use beginning-of-command, instead check
that prev line isn't a continuation.
For continuations, compute beginning of command, and use
for both sides of the condition-case.

(matlab-next-line-indentation):
Use `matlab-with-current-restriction' instead of using
beginning-of-command by itself.
2019-12-06 22:57:32 -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 30b8450c02 matlab-shell-gud.el:
(gud-matlab-marker-filter): For any output not terminated by \n,
check for any special prefixes, and dump the rest if those aren't there.
2019-12-02 21:53:48 -05:00
Eric Ludlam 49338f8979 toolbox/emacscd.m
Add example code for identifying if you're inside Emacs for this ML session
and sending the <EMACSCAP> cookie only if we are in Emacs.
2019-12-01 21:15:57 -05:00
Eric Ludlam f0139a5000 toolbox/help.m
Fix cases where you can't get help on functions in matlab-emacs/toolbox,
or case where cwd is matlab-emacs/toolbox.
2019-12-01 20:52:12 -05:00
Eric Ludlam bff6d627fd tests/mstest.el:
Add tests for <EMACSCAP> tokens.
(mstest-run-all-tests): Add mstest-capture.
(mstest-completion): Fix expected value now that 'emacscd' is in toolbox.
(mstest-capture): New.  Tests help and custom testeeval.m.

tests/testeeval.m
New.  Test Emacs EVAL.
Uses <EMACSCAP> token with (eval) buffer to tell Emacs to set
a variable that mstest can check.
2019-12-01 20:36:49 -05:00