Skip to content

Commit

Permalink
changed history file location
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud committed Aug 13, 2024
1 parent bfc49b0 commit dc908c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions M2/Macaulay2/m2/Core.m2
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ needs = filename -> if not filesLoaded#?filename then load filename else (
-----------------------------------------------------------------------------
-- Setup persistent history
-----------------------------------------------------------------------------
historyFilename = "~/.Macaulay2-history"
historyFilename = "history.m2"

if not gotarg "--no-readline" then (
addStartFunction(() -> readHistory historyFilename);
if not noinitfile and not gotarg "--no-readline" then (
addStartFunction(() -> readHistory(applicationDirectory() | historyFilename));
-- TODO: find a better alternative to addEndFunction, because
-- exiting with Ctrl+D duplicates the last line of history file,
-- but if we use lineNumber-1, then exit and restart miss the first
-- entry from the current session. Moreover, maybe we shouldn't save
-- exit and restart in the history anyway.
addEndFunction(() -> appendHistory(lineNumber, historyFilename));
addEndFunction(() -> appendHistory(lineNumber, applicationDirectory() | historyFilename));
)

-----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions M2/Macaulay2/m2/system.m2
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ setUpApplicationDirectory = () -> (
f := (n,c) -> (n = dir|n; if not fileExists n then n << c << close);
f("init.m2", sampleInitFile);
f("README", readmeFile);
f(historyFilename, concatenate(
"-- This is the beginning of your Macaulay2 log stored at ",
dir, historyFilename, newline));
)

-----------------------------------------------------------------------------
Expand Down

0 comments on commit dc908c3

Please sign in to comment.