Skip to content

Commit 99c0dad

Browse files
hyrodiumJeffBezansonKristofferC
authored
Rename ipython_mode to numbered_prompt (#49314)
Co-authored-by: Jeff Bezanson <[email protected]> Co-authored-by: Kristoffer Carlsson <[email protected]>
1 parent 29d1990 commit 99c0dad

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

HISTORY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ Standard library changes
135135
* The contextual module which is active in the REPL can be changed (it is `Main` by default),
136136
via the `REPL.activate(::Module)` function or via typing the module in the REPL and pressing
137137
the keybinding Alt-m ([#33872]).
138-
* An "IPython mode" which mimics the behaviour of the prompts and storing the evaluated result in `Out` can be
139-
activated with `REPL.ipython_mode!()`. See the manual for how to enable this at startup ([#46474]).
138+
* A "numbered prompt" mode which prints numbers for each input and output and stores evaluated results in `Out` can be
139+
activated with `REPL.numbered_prompt!()`. See the manual for how to enable this at startup ([#46474]).
140140
* Tab completion displays available keyword arguments ([#43536])
141141

142142
#### SuiteSparse

stdlib/REPL/docs/src/index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,19 +617,20 @@ julia> REPL.activate(CustomMod)
617617
var 8 bytes Int64
618618
```
619619

620-
## IPython mode
620+
## Numbered prompt
621+
622+
It is possible to get an interface which is similar to the IPython REPL and the Mathematica notebook with numbered input prompts and output prefixes. This is done by calling `REPL.numbered_prompt!()`. If you want to have this enabled on startup, add
621623

622-
It is possible to get an interface which is similar to the IPython REPL with numbered input prompts and output prefixes. This is done by calling `REPL.ipython_mode!()`. If you want to have this enabled on startup, add
623624
```julia
624625
atreplinit() do repl
625626
if !isdefined(repl, :interface)
626627
repl.interface = REPL.setup_interface(repl)
627628
end
628-
REPL.ipython_mode!(repl)
629+
REPL.numbered_prompt!(repl)
629630
end
630631
```
631632

632-
to your `startup.jl` file. In `IPython` mode the variable `Out[n]` (where `n` is an integer) can be used to refer to earlier results:
633+
to your `startup.jl` file. In numbered prompt the variable `Out[n]` (where `n` is an integer) can be used to refer to earlier results:
633634

634635
```julia-repl
635636
In [1]: 5 + 3

stdlib/REPL/src/REPL.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ function run_frontend(repl::StreamREPL, backend::REPLBackendRef)
13961396
nothing
13971397
end
13981398

1399-
module IPython
1399+
module Numbered
14001400

14011401
using ..REPL
14021402

@@ -1468,7 +1468,7 @@ function __current_ast_transforms(backend)
14681468
end
14691469

14701470

1471-
function ipython_mode!(repl::LineEditREPL=Base.active_repl, backend=nothing)
1471+
function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
14721472
n = Ref{Int}(0)
14731473
set_prompt(repl, n)
14741474
set_output_prefix(repl, n)
@@ -1480,14 +1480,14 @@ end
14801480
Out[n]
14811481
14821482
A variable referring to all previously computed values, automatically imported to the interactive prompt.
1483-
Only defined and exists while using [IPython mode](@ref IPython-mode).
1483+
Only defined and exists while using [Numbered prompt](@ref Numbered-prompt).
14841484
14851485
See also [`ans`](@ref).
14861486
"""
14871487
Base.MainInclude.Out
14881488

14891489
end
14901490

1491-
import .IPython.ipython_mode!
1491+
import .Numbered.numbered_prompt!
14921492

14931493
end # module

stdlib/REPL/test/repl.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ fake_repl() do stdin_write, stdout_read, repl
16021602
@test buffercontents(LineEdit.buffer(s)) == "1234αβ56γ"
16031603
end
16041604

1605-
# Non standard output_prefix, tested via `ipython_mode!`
1605+
# Non standard output_prefix, tested via `numbered_prompt!`
16061606
fake_repl() do stdin_write, stdout_read, repl
16071607
repl.interface = REPL.setup_interface(repl)
16081608

@@ -1611,7 +1611,7 @@ fake_repl() do stdin_write, stdout_read, repl
16111611
REPL.run_repl(repl; backend)
16121612
end
16131613

1614-
REPL.ipython_mode!(repl, backend)
1614+
REPL.numbered_prompt!(repl, backend)
16151615

16161616
global c = Base.Event(true)
16171617
function sendrepl2(cmd, txt)

0 commit comments

Comments
 (0)