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.
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.
* matlab-shell.el (matlab-shell-region->script): 676 apply patch provided by Karthik Chikmagalur <karthikchikmagalur@gmail.com>: Copy all local functions to script.
(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.
(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.
(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.
(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.
(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.
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
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.
(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.
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.
(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.
(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.
(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.
(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'.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
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.
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.
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.
(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.
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
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.
(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.)
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.
(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.
(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.