[ANN] Diary.jl 📔

Ideally, set ENV["JULIA_DEBUG"] = "Diary" before using Diary. Then it should print some information as it loads and which history file it’s tracking. Could you also try to start Julia without Revise and OhMyREPL? Just start a clean session without the startup file: julia --startup-file=no --project tmp/lel.

yeah makes sense to use ". Without it threw an error.

╰─➤  julia --startup-file=no --project=~/tmp/lel                                                                                                                                                                                        [15-01-21 | 7:48:35]
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

julia> x = 1
1

julia> ENV["JULIA_DEBUG"] = "Diary"
"Diary"

julia> using Diary
┌ Debug: Diary.jl: Watching: /tmp/jl_skCPTH
└ @ Diary ~/.julia/packages/Diary/QBchx/src/Diary.jl:36

julia> x = 1
1

julia> x = 2
2

julia> x +m x
ERROR: syntax: extra token "x" after end of expression
Stacktrace:
 [1] top-level scope at none:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

julia> x + x
4

Still no file :frowning:

Can you check if anything is written to the file it is watching? In this case: /tmp/jl_skCPTH.

The content of the file is:

36132 # time: 2021-01-15 19:56:25 CET                                                                                                                                                                       
36133 # mode: julia                                                                                                                                                                       
36134     ENV["JULIA_DEBUG"] = "Diary"                                                                                                                                                                       
36135 # time: 2021-01-15 19:56:28 CET 

36136 # mode: julia 

36137     using Diary

These were my latest commands

julia> ENV["JULIA_DEBUG"] = "Diary"
"Diary"

julia> using Diary
┌ Debug: Diary.jl: Watching: /tmp/jl_bC93QO
└ @ Diary ~/.julia/packages/Diary/QBchx/src/Diary.jl:36

julia> x = 1
1

julia> y = 2
2

julia> x + y
3

julia> x = 2
2

My history is over 36k entries long, a problem?

It shouldn’t be. Mine is 24k right now.

What surprises me is that it doesn’t write the history log to that file. What is ENV["JULIA_HISTORY"] set to?

With Diary.jl loaded, it is:

"JULIA_HISTORY"            => "/tmp/jl_bC93QO"

And do you have the same issue when you start Julia and load Diary without a startup file? (with --startup-file=no)?

I tried both, no Dairy.jl file

That is very peculiar. I tried both Julia 1.5.2 and 1.5.3, and I cannot reproduce. What about REPL.find_hist_file()?

Also, can you check if what you type in the REPL is written to the standard location: ~/.julia/logs/repl_history instead?

And what happens if you create a Diary.toml file in ~/.julia/config?

julia> using Diary

julia> using REPL

julia> REPL.find_hist_file()
"/tmp/jl_duDEpW"

The standard history file still works flawless. Can I test something else like calling a save function or similar?

Ok, then it seems like Diary is loading and working correctly, but Julia for some reason does not respect the history file location that it is told to use. I’m a bit surprised as to why that would happen, though I’ve noticed it when loading OhMyREPL.

1 Like