Skip to content

Commit

Permalink
[Fix #104] adjust julia help and completion for julia v0.3.0
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/ESS/trunk@6030 0bbaf3bd-34e0-0310-bf65-c717079852d4
  • Loading branch information
vspinu committed Aug 24, 2014
1 parent b44ed31 commit 0d5ca2c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 63 deletions.
72 changes: 18 additions & 54 deletions etc/ess-julia.jl
@@ -1,70 +1,33 @@
module ESS

function help_categories()
Base.Help.init_help()
for cat = Base.Help.CATEGORY_LIST
if !isempty(Base.Help.CATEGORY_DICT[cat])
println("\"$cat\" ")
end
end
end

function all_help_topics()
Base.Help.init_help()
## show all categories
for cat = Base.Help.CATEGORY_LIST
if !isempty(Base.Help.CATEGORY_DICT[cat])
for (func, _ ) in Base.Help.MODULE_DICT
if !isempty(Base.Help.MODULE_DICT[func])
println()
show(cat); println();
for func = Base.Help.CATEGORY_DICT[cat]
print(" ")
show(func)
end
show(func);
end
end
end

function help(topic::String)
Base.Help.init_help()
if !haskey(Base.Help.CATEGORY_DICT, topic)
# if it's not a category, try another named thing
try
obj = eval(current_module(), parse(topic))
Base.Help.help(obj)
catch
print("No help information found")
end
else
ln = length(topic)
bar = " ===" * "="^ln * "==="
println(bar)
println(" = ", topic, " =")
println(bar, "\n")
for func = Base.Help.CATEGORY_DICT[topic]
Base.Help.help(func)
println()
println("-"^72)
end
end
end
Base.Help.help(topic)
end

## modified version of function show(io::IO, m::Method)
function fun_args(m::Method)
tv = m.tvars
io = STDOUT::IO
if !isa(tv,Tuple)
tv = (tv,)
end
if !isempty(tv)
Base.show_delim_array(io, tv, '{', ',', '}', false)
end
li = m.func.code
e = Base.uncompressed_ast(li)
argnames = e.args[1]
decls = map(Base.argtype_decl_string, argnames, {m.sig...})
print(io, "(")
print_joined(io, decls, ",", ",")
print(io, ")")
tv, decls, file, line = Base.arg_decl_parts(m)
io = STDOUT::IO
if !isempty(tv)
Base.show_delim_array(io, tv, '{', ',', '}', false)
end
li = m.func.code
e = Base.uncompressed_ast(li)
argnames = e.args[1]
print(io, "(")
print_joined(io, [isempty(d[2]) ? d[1] : d[1]*"::"*d[2] for d in decls], ",", ",")
print(io, ")")
end

## modified versionof show(io::IO, mt::MethodTable)
Expand All @@ -76,8 +39,9 @@ function fun_args(f::Function)
end
print("(list \"$mod\" nil '(")
d = mt.defs
while !is(d,())
while !is(d, ())
print("\"")
## method
fun_args(d)
print("\" ")
d = d.next
Expand Down
18 changes: 9 additions & 9 deletions lisp/ess-julia.el
Expand Up @@ -292,14 +292,14 @@ VISIBLY is not currently used."
(page (ess-completing-read "Lookup:" pages nil t)))
(browse-url (get-text-property 1 :manual page))))

(defvar julia--reference-topics nil)
(defun julia-reference-lookup-function (&rest args) ; args are not used
(interactive)
"Look up reference topics"
;; <li class="toctree-l1"><a class="reference internal" href="introduction/">Introduction</a></li>
(let* ((pages (ess-get-words-from-vector "ESS.help_categories()\n")))
(ess-display-help-on-object
(ess-completing-read "Category" pages nil t))))
;; julia 0.3.0 doesn't provide categories. Thus we don't support this anymore.
;; (defun julia-reference-lookup-function (&rest args) ; args are not used
;; (interactive)
;; "Look up reference topics"
;; ;; <li class="toctree-l1"><a class="reference internal" href="introduction/">Introduction</a></li>
;; (let* ((pages (ess-get-words-from-vector "ESS.help_categories()\n")))
;; (ess-display-help-on-object
;; (ess-completing-read "Category" pages nil t))))



Expand Down Expand Up @@ -460,7 +460,7 @@ to look up any doc strings."
(ess-get-help-topics-function . 'julia-get-help-topics)
(ess-help-web-search-command . "http://docs.julialang.org/en/latest/search/?q=%s")
(ess-manual-lookup-command . 'julia-manual-lookup-function)
(ess-reference-lookup-command . 'julia-reference-lookup-function)
;; (ess-reference-lookup-command . 'julia-reference-lookup-function)
(ess-load-command . "include(\"%s\")\n")
(ess-funargs-command . "ESS.fun_args(\"%s\")\n")
(ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+")
Expand Down

0 comments on commit 0d5ca2c

Please sign in to comment.