Skip to content

Commit

Permalink
InteractiveUtils: define default editors during package load (#37839)
Browse files Browse the repository at this point in the history
Previously if you defined a new editor before calling `edit` it
prevented the default editors from being defined ever. This defines
the default editors no matter what.
  • Loading branch information
StefanKarpinski authored Oct 1, 2020
1 parent 4422648 commit d57de75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stdlib/InteractiveUtils/src/editless.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ function define_default_editors()
define_editor(Any[
"vim", "vi", "nvim", "mvim", "nano", "micro",
r"\bemacs\b.*\s(-nw|--no-window-system)\b",
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], wait=true) do cmd, path, line
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b",
], wait=true) do cmd, path, line
`$cmd +$line $path`
end
define_editor(["textmate", "mate", "kate"]) do cmd, path, line
Expand Down Expand Up @@ -159,6 +160,7 @@ function define_default_editors()
end
end
end
define_default_editors()

"""
editor()
Expand Down Expand Up @@ -191,7 +193,6 @@ by setting `JULIA_EDITOR`, `VISUAL` or `EDITOR` as an environment variable.
See also: [`define_editor`](@ref)
"""
function edit(path::AbstractString, line::Integer=0)
isempty(EDITOR_CALLBACKS) && define_default_editors()
path isa String || (path = convert(String, path))
if endswith(path, ".jl")
p = find_source_file(path)
Expand Down

0 comments on commit d57de75

Please sign in to comment.