M2
M2 copied to clipboard
Incorrect code location for functions defined in standard input
Since #3403:
i1 : f = x -> x^2
o1 = f
o1 : FunctionClosure
i2 : code f
o2 = stdio:1:6-1:11: --source code:
-- This is the beginning of your Macaulay2 log stored at /home/profzoom/.Macaulay2/history.m2
I suppose the solution would be to keep track of how long the history is when we start M2 and add that to the line number when finding the code.
Ah yes I should have noticed this from the getHistory lines in code.m2.
This is actually more complicated than I expected.
I added a call to where_history in this commit, but:
- it seems to return zero if it's called before the first prompt, even if it's after
readHistoryapparently! - it seems to be off by an inconsistent number (up to 4 even) from the right number to get
codeworking in your example.
I'm not sure if I have time to debug this. We can disable history if this is too complicated to resolve.
I think I figured it out -- see #3416.
Closed by #3416