summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-13 05:24:28 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-13 05:24:28 -0400
commit70344b82e70f454462f31daec05d79554804e8f8 (patch)
treed9f3252972cd3b83453ea0d5dfee932f99c4a793 /src/global.cc
parent037dd0f716e82568b005a78ee4d79fce0b886af3 (diff)
downloadfork-ledger-70344b82e70f454462f31daec05d79554804e8f8.tar.gz
fork-ledger-70344b82e70f454462f31daec05d79554804e8f8.tar.bz2
fork-ledger-70344b82e70f454462f31daec05d79554804e8f8.zip
Added a "reload" command, for use at the REPL
Created a new function, session_t::reread_journal_files, which throws away all previous state data and reads in the same files again. This is needed to allow Emacs to communicate with Ledger via the REPL, so that it tell Ledger when it has made changes to the user's data file.
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/global.cc b/src/global.cc
index c012b17d..b2dc24fc 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -109,24 +109,6 @@ void global_scope_t::read_init()
}
}
-void global_scope_t::read_journal_files()
-{
- INFO_START(journal, "Read journal file");
-
- string master_account;
- if (session().HANDLED(account_))
- master_account = session().HANDLER(account_).str();
-
- std::size_t count = session().read_data(master_account);
- if (count == 0)
- throw_(parse_error, "Failed to locate any journal entries; "
- "did you specify a valid file with -f?");
-
- INFO_FINISH(journal);
-
- INFO("Found " << count << " entries");
-}
-
char * global_scope_t::prompt_string()
{
static char prompt[32];
@@ -195,7 +177,7 @@ void global_scope_t::execute_command(strings_list args, bool at_repl)
if (! is_precommand) {
if (! at_repl)
- read_journal_files();
+ session().read_journal_files();
normalize_report_options(verb);
}