julia-shell-mode
julia-shell-mode copied to clipboard
Handling help queries
In the standard Julia shell, pressing ?
at an empty prompt changes the prompt to help?>
, and entering a word followed by a newline gives help on that word.
This is a very useful tool, and should be implemented in julia-shell-mode, as well. Note that calling @doc
on the word is not really the same, because
-
@doc
does not give hints on alternatives -
@doc
cannot be used on some words, such aslet
orfor
The method for displaying the documentation need not be the same, for example it can be an Emacs function bound to shortcut such as C-c C-h
, looking up the word at point or querying the user.
The standard shell also has a shell mode, which can be entered by pressing ;
at an empty prompt. But running shell commands is already present in Emacs, so it is low priority.
See also the Julia manual on help mode.
I agree. I recently ran into the same problem. Before v0.4, I was able to circumvent that issue by just using help()
from the REPL, but that feature was removed in v0.4. It seems like most of the docs/help code happens here, and I'll try to look into it soon. Any suggestions?
EDIT: I'm probably going to build something that does this
Thanks for the quick reply!
Based on the code you've mentioned, maybe you can do the following:
-
Define a help function as soon as the shell starts:
julia_shell_help(ex) = eval(:(Base.Docs.@repl $(symbol(ex))))
This function accepts either strings (e.g. "for") or symbols (e.g. :let) as arguments.
-
Substitute (internally)
?foo
withjulia_shell_help("foo")
. History should show the original?foo
version.
I'd love to see this feature implemented too. Just started learning Julia. :grinning: