From 87f010ff067134b0561d6e658bbbbe3c971f3841 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sat, 24 Jan 2009 18:45:35 +0000 Subject: bugfix: load keys even in non-interactive mode to avoid the loss of user-configured key bindings --- ChangeLog | 3 +++ src/args.c | 27 ++++++++++++--------------- src/calcurse.c | 3 +-- src/io.c | 4 +++- src/keys.c | 4 ++-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f71449..9e05459 100755 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ * configure.ac: switch to 2.5 * src/calcurse.1: manpage updated for 2.5 version + + * src/args.c (parse_args): load keys even in non-interactive mode + to avoid the loss of user configured key bindings 2009-01-23 Frederic Culot diff --git a/src/args.c b/src/args.c index e43323a..2facfd5 100755 --- a/src/args.c +++ b/src/args.c @@ -1,4 +1,4 @@ -/* $calcurse: args.c,v 1.44 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: args.c,v 1.45 2009/01/24 18:45:35 culot Exp $ */ /* * Calcurse - text-based organizer @@ -730,7 +730,7 @@ parse_args (int argc, char **argv, conf_t *conf) { usage (); usage_try (); - return (EXIT_FAILURE); + return EXIT_FAILURE; /* Incorrect arguments */ } else if (Dflag && cflag) @@ -739,7 +739,7 @@ parse_args (int argc, char **argv, conf_t *conf) stderr); usage (); usage_try (); - return (EXIT_FAILURE); + return EXIT_FAILURE; } else { @@ -764,14 +764,17 @@ parse_args (int argc, char **argv, conf_t *conf) io_init (cfile, datadir); no_file = io_check_data_files (); if (dflag || aflag || nflag || iflag || xflag || rflag || sflag) - io_load_app (); + { + vars_init (conf); + custom_load_conf (conf, 0); + io_load_keys (conf->pager); + io_load_app (); + io_load_todo (); + } } if (iflag) { notify_init_vars (); - vars_init (conf); - custom_load_conf (conf, 0); - io_load_todo (); io_import_data (IO_IMPORT_ICAL, conf, ifile); io_save_cal (conf, IO_SAVE_DISPLAY_NONE); non_interactive = 1; @@ -779,11 +782,9 @@ parse_args (int argc, char **argv, conf_t *conf) if (xflag) { notify_init_vars (); - custom_load_conf (conf, 0); - io_load_todo (); io_export_data (xfmt, conf); non_interactive = 1; - return (non_interactive); + return non_interactive; } if (tflag) { @@ -798,8 +799,6 @@ parse_args (int argc, char **argv, conf_t *conf) if (dflag || rflag || sflag) { notify_init_vars (); - vars_init (conf); - custom_load_conf (conf, 0); if (dflag) date_arg (ddate, add_line, Nflag, conf); if (rflag || sflag) @@ -811,8 +810,6 @@ parse_args (int argc, char **argv, conf_t *conf) date_t day; day.dd = day.mm = day.yyyy = 0; notify_init_vars (); - vars_init (conf); - custom_load_conf (conf, 0); app_found = app_arg (add_line, &day, 0, Nflag, conf); non_interactive = 1; } @@ -823,6 +820,6 @@ parse_args (int argc, char **argv, conf_t *conf) io_init (cfile, datadir); no_file = io_check_data_files (); } - return (non_interactive); } + return non_interactive; } diff --git a/src/calcurse.c b/src/calcurse.c index 841603a..552cfb4 100755 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -1,4 +1,4 @@ -/* $calcurse: calcurse.c,v 1.77 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: calcurse.c,v 1.78 2009/01/24 18:45:35 culot Exp $ */ /* * Calcurse - text-based organizer @@ -134,7 +134,6 @@ main (int argc, char **argv) } vars_init (&conf); - keys_init (); wins_init (); wins_slctd_init (); notify_init_bar (); diff --git a/src/io.c b/src/io.c index 2f282a5..00c48f8 100755 --- a/src/io.c +++ b/src/io.c @@ -1,4 +1,4 @@ -/* $calcurse: io.c,v 1.57 2009/01/24 14:44:25 culot Exp $ */ +/* $calcurse: io.c,v 1.58 2009/01/24 18:45:35 culot Exp $ */ /* * Calcurse - text-based organizer @@ -1278,6 +1278,8 @@ io_load_keys (char *pager) io_file_t *log; int i, skipped, loaded, line; const int MAX_ERRORS = 5; + + keys_init (); #define HSIZE 256 HTABLE_HEAD (ht_keybindings, HSIZE, ht_keybindings_s) ht_keys = diff --git a/src/keys.c b/src/keys.c index 387e08b..6ca40f0 100755 --- a/src/keys.c +++ b/src/keys.c @@ -1,4 +1,4 @@ -/* $calcurse: keys.c,v 1.15 2009/01/24 14:44:25 culot Exp $ */ +/* $calcurse: keys.c,v 1.16 2009/01/24 18:45:35 culot Exp $ */ /* * Calcurse - text-based organizer @@ -113,7 +113,7 @@ dump_intro (FILE *fd) "# the 'ESC', 'SPC' and 'TAB' keyword, respectively.\n" "# Arrow keys can also be specified with the UP, DWN, LFT, RGT keywords.\n" "# Last, Home and End keys can be assigned using 'KEY_HOME' and 'KEY_END'\n" - "# keywords" + "# keywords." "\n#\n" "# A description of what each ACTION keyword is used for is available\n" "# from calcurse online configuration menu.\n"); -- cgit v1.2.3-70-g09d2