emacs-matlab/toolbox/help.m
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

40 lines
973 B
Matlab

function [out, docTopic] = help(varargin)
% Provide help, augmented so Emacs picks it up to display in a special buffer.
% See the help for the built-in help command by asking for "help help" in
% MATLAB, which will redirect to the correct location.
ah = which('help', '-all');
builtinhelp = ah{2};
[ helpPath, ~ ] = fileparts(builtinhelp);
args = varargin;
cookie = true;
if nargin > 0 && strcmp(args{1}, '-emacs')
cookie=false;
args = args(2:end);
end
% Provide access to the built-in help by CDing to that location.
oldpath = pwd;
cd(helpPath);
cleanup = onCleanup(@()cd(oldpath));
switch nargout
case 0
if cookie
disp('<EMACSCAP>(*MATLAB Help*)');
end
help(args{:});
if cookie
disp('</EMACSCAP>');
end
case 1
[out] = help(args{:});
case 2
[out, docTopic] = help(args{:});
end
end