From 0559a2e8494d548bc60130cabd2a686688da4b20 Mon Sep 17 00:00:00 2001 From: Jon Malmaud Date: Thu, 12 Jan 2017 15:48:52 -0500 Subject: [PATCH 1/3] Don't show built-in modules in whos() --- base/interactiveutil.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index ddb77a589adf9..68fceb78b513d 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -667,7 +667,7 @@ Print information about exported global variables in a module, optionally restri The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object. """ -function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"") +function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*(Base|Main|Core)).*$") maxline = displaysize(io)[2] line = zeros(UInt8, maxline) head = PipeBuffer(maxline + 1) From 0f38766833ed5893f6527053f9365b045c6d7e0f Mon Sep 17 00:00:00 2001 From: Jon Malmaud Date: Thu, 12 Jan 2017 16:24:45 -0500 Subject: [PATCH 2/3] Modify whos() --- base/interactiveutil.jl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 68fceb78b513d..3db65c1f32892 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -667,7 +667,7 @@ Print information about exported global variables in a module, optionally restri The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object. """ -function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*(Base|Main|Core)).*$") +function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"") maxline = displaysize(io)[2] line = zeros(UInt8, maxline) head = PipeBuffer(maxline + 1) @@ -677,17 +677,20 @@ function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.* value = getfield(m, v) @printf head "%30s " s try - bytes = summarysize(value) - if bytes < 10_000 - @printf(head, "%6d bytes ", bytes) + if s ∈ ("Base", "Main", "Core") + print(head, " ") else - @printf(head, "%6d KB ", bytes ÷ (1024)) + bytes = summarysize(value) + if bytes < 10_000 + @printf(head, "%6d bytes ", bytes) + else + @printf(head, "%6d KB ", bytes ÷ (1024)) + end end print(head, summary(value)) catch e print(head, "#=ERROR: unable to show value=#") end - newline = search(head, UInt8('\n')) - 1 if newline < 0 newline = nb_available(head) From a6f27880b4a53dace6dee620d3a9b808d0836fb5 Mon Sep 17 00:00:00 2001 From: Jon Malmaud Date: Fri, 13 Jan 2017 13:53:43 -0500 Subject: [PATCH 3/3] Modify whos() --- base/interactiveutil.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 3db65c1f32892..d6e8648f120fc 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -677,7 +677,7 @@ function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"") value = getfield(m, v) @printf head "%30s " s try - if s ∈ ("Base", "Main", "Core") + if value ∈ (Base, Main, Core) print(head, " ") else bytes = summarysize(value)