Skip to content

Commit d57de75

Browse files
InteractiveUtils: define default editors during package load (#37839)
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.
1 parent 4422648 commit d57de75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/InteractiveUtils/src/editless.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ function define_default_editors()
121121
define_editor(Any[
122122
"vim", "vi", "nvim", "mvim", "nano", "micro",
123123
r"\bemacs\b.*\s(-nw|--no-window-system)\b",
124-
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b"], wait=true) do cmd, path, line
124+
r"\bemacsclient\b.\s*-(-?nw|t|-?tty)\b",
125+
], wait=true) do cmd, path, line
125126
`$cmd +$line $path`
126127
end
127128
define_editor(["textmate", "mate", "kate"]) do cmd, path, line
@@ -159,6 +160,7 @@ function define_default_editors()
159160
end
160161
end
161162
end
163+
define_default_editors()
162164

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

0 commit comments

Comments
 (0)