Skip to content

Commit

Permalink
Merge pull request #32 from timholy/teh/meta
Browse files Browse the repository at this point in the history
Describe keys as Meta and link to Mac keyboard configuration. Fixes #28
  • Loading branch information
timholy committed Aug 22, 2018
2 parents bd04cdd + d3f297e commit f2d7ff5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ Note that Rebugger may benefit from custom configuration, as described in the do
In terms of usage, very briefly

- "step in" is achieved by positioning your cursor in your input line to the beginning of
the call expression you wish to descend into. Then hit <kbd> Alt-e </kbd> ("enter").
- for an expression that generates an error, hit <kbd> Alt-s </kbd> ("stacktrace")
the call expression you wish to descend into. Then hit <kbd> Meta-e </kbd> ("enter").
- for an expression that generates an error, hit <kbd> Meta-s </kbd> ("stacktrace")
to capture the stacktrace and populate your REPL history with a sequence of expressions
that contain the method bodies of the calls in the stacktrace.

Complete examples are provided in the documentation.
<kbd> Meta </kbd> means <kbd> Esc </kbd> or, if your system is configured appropriately,
<kbd> Alt </kbd> (Linux/Windows) or <kbd> Option </kbd> (Macs).
More information and complete examples are provided in the documentation.

## Status

Expand Down
24 changes: 14 additions & 10 deletions docs/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

Rebugger works from Julia's native REPL prompt. Currently there are two important keybindings:

- Alt-e maps to "enter" or "step in"
- Alt-s maps to "stacktrace" (for commands that throw an error)

If you're on OSX, you may want to enable
- Meta-e maps to "enter" or "step in"
- Meta-s maps to "stacktrace" (for commands that throw an error)

Meta reliably maps to `Esc`, and if using `Esc` you should hit the two keys in
sequence rather than simultaneously.
For many users `Alt` (or `Option`) may be more convenient, as it can be pressed
simultaneously with the key.
If you're on OSX, you may want to enable
"[Use `option` as the Meta key](https://github.com/timholy/Rebugger.jl/issues/28#issuecomment-414852133)"
in your Terminal settings to avoid the need to press Esc before each Rebugger command.

Expand All @@ -18,7 +22,7 @@ at the desired location in the command line:
<img src="images/stepin1.png" width="200px"/>
```

Now if you hit Alt-e, you should see something like this:
Now if you hit Meta-e, you should see something like this:

```@raw html
<img src="images/stepin2.png" width="822px"/>
Expand All @@ -33,10 +37,10 @@ The magenta line tells you which method you are stepping into.
Indented blue line(s) show the value(s) of any input arguments or type parameters.

If you're following along, move your cursor to the next `show` call as illustrated above.
Hit Alt-e again. You should see a new `show` method, this time with two input arguments.
Hit Meta-e again. You should see a new `show` method, this time with two input arguments.

Now let's demonstrate another important display item: position your cursor at the
beginning of the `_show_empty` call and hit Alt-e.
beginning of the `_show_empty` call and hit Meta-e.
The display should now look like this:

```@raw html
Expand Down Expand Up @@ -73,7 +77,7 @@ Stacktrace:
in expression starting at REPL[3]:1
```

Now hit the up arrow and then Alt-s. After a short delay, you should see something like this:
Now hit the up arrow and then Meta-s. After a short delay, you should see something like this:
```julia
julia> colorant"hsl(80%, 20%, 15%)"
┌ Warning: Tuple{getfield(Colors, Symbol("#@colorant_str")),LineNumberNode,Module,Any} was not found, perhaps it was generated by code
Expand Down Expand Up @@ -141,7 +145,7 @@ Stacktrace:
[13] add(::String) at /home/tim/src/julia-1.0/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:69
[14] top-level scope at none:0

julia> Pkg.add("NoPkg") # hit Alt-s here
julia> Pkg.add("NoPkg") # hit Meta-s here
Captured elements of stacktrace:
[1] pkgerror(msg::String...) in Pkg.Types at /home/tim/src/julia-1.0/usr/share/julia/stdlib/v1.0/Pkg/src/Types.jl:120
[2] ensure_resolved(env::Pkg.Types.EnvCache, pkgs::AbstractArray{Pkg.Types.PackageSpec,1}) in Pkg.Types at /home/tim/src/julia-1.0/usr/share/julia/stdlib/v1.0/Pkg/src/Types.jl:860
Expand Down Expand Up @@ -184,7 +188,7 @@ Stacktrace:
[2] copyto!(::Array{Float64,1}, ::UnitRange{Int64}) at ./abstractarray.jl:723
[3] top-level scope at none:0

julia> copyto!(dest, 1:4) # hit Alt-s here
julia> copyto!(dest, 1:4) # hit Meta-s here
Captured elements of stacktrace:
[1] copyto!(::IndexStyle, dest::AbstractArray, ::IndexStyle, src::AbstractArray) in Base at abstractarray.jl:727
[2] copyto!(dest::AbstractArray, src::AbstractArray) in Base at abstractarray.jl:723
Expand Down

0 comments on commit f2d7ff5

Please sign in to comment.