Skip to content

Commit 3ece193

Browse files
hyrodiumJeffBezansonKristofferC
committed
Rename ipython_mode to numbered_prompt (#49314)
Co-authored-by: Jeff Bezanson <[email protected]> Co-authored-by: Kristoffer Carlsson <[email protected]> (cherry picked from commit 99c0dad)
1 parent 6d03913 commit 3ece193

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

NEWS.md

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

146146
#### 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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ function run_frontend(repl::StreamREPL, backend::REPLBackendRef)
13991399
nothing
14001400
end
14011401

1402-
module IPython
1402+
module Numbered
14031403

14041404
using ..REPL
14051405

@@ -1469,15 +1469,16 @@ function __current_ast_transforms(backend)
14691469
end
14701470

14711471

1472-
function ipython_mode!(repl::LineEditREPL=Base.active_repl, backend=nothing)
1472+
function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
14731473
n = Ref{Int}(0)
14741474
set_prompt(repl, n)
14751475
set_output_prefix(repl, n)
14761476
push!(__current_ast_transforms(backend), @nospecialize(ast) -> out_transform(ast, n))
14771477
return
14781478
end
1479+
14791480
end
14801481

1481-
import .IPython.ipython_mode!
1482+
import .Numbered.numbered_prompt!
14821483

14831484
end # module

stdlib/REPL/test/repl.jl

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

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

@@ -1609,7 +1609,7 @@ fake_repl() do stdin_write, stdout_read, repl
16091609
REPL.run_repl(repl; backend)
16101610
end
16111611

1612-
REPL.ipython_mode!(repl, backend)
1612+
REPL.numbered_prompt!(repl, backend)
16131613

16141614
global c = Base.Event(true)
16151615
function sendrepl2(cmd, txt)

0 commit comments

Comments
 (0)