Hi again, I'm getting old and stupid. In my first message I'd pasted mutt.h two times and forgot to include keymap.c.
Anyway, I found a first problem. Compiled with my patches I get this error at startup: Invalid value for option send_charset: "us-ascii:utf-8" It complains when I set any but utf-8 in that variable. I'm not able to relate with my modifications. --- mutt-1.7.2/curs_lib.c Mon Dec 5 00:46:59 2016 +++ mutt-1.7.2-modified/curs_lib.c Sat Feb 25 14:45:01 2017 @@ -148,7 +148,10 @@ event_t mutt_getch (void) ret.ch = ch; ret.op = 0; - return (ch == ctrl ('G') ? err : ret); + if (option (OPTESCKEYABORTS)) + return (ch == '\033' ? err : ret); + else + return (ch == ctrl ('G') ? err : ret); } int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles) --- mutt-1.7.2/mutt.h Mon Dec 5 00:46:59 2016 +++ mutt-1.7.2-modified/mutt.h Sat Feb 25 14:31:12 2017 @@ -340,6 +340,7 @@ enum OPTEDITHDRS, OPTENCODEFROM, OPTENVFROM, + OPTESCKEYABORTS, OPTFASTREPLY, OPTFCCCLEAR, OPTFOLLOWUPTO, --- mutt-1.7.2/init.h Mon Dec 5 00:46:59 2016 +++ mutt-1.7.2-modified/init.h Sat Feb 25 14:35:34 2017 @@ -762,6 +762,14 @@ struct option_t MuttVars[] = { ** .pp ** Escape character to use for functions in the built-in editor. */ + { "esc_key_aborts", DT_BOOL, R_NONE, OPTESCKEYABORTS, 0 }, + /* + ** .pp + ** For vi-like bindings users. Set this value to ``yes'' to use + ** ESC key instead of the default Ctrl-G to abort commands. Take + ** in care some predifined emacs-like Meta prefixed bindings will + ** stop working. + */ { "fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, 0 }, /* ** .pp --- mutt-1.7.2/keymap.c Sat Feb 25 14:47:29 2017 +++ mutt-1.7.2.orig/keymap.c Mon Dec 5 00:46:59 2016 @@ -1133,32 +1133,16 @@ void mutt_what_key (void) { int ch; - if (option (OPTESCKEYABORTS)) - { - mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (ESC to abort): ")); - do { - ch = getch(); - if (ch != ERR && ch != '\033') - { - mutt_message(_("Char = %s, Octal = %o, Decimal = %d"), - km_keyname(ch), ch, ch); - } + mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (^G to abort): ")); + do { + ch = getch(); + if (ch != ERR && ch != ctrl ('G')) + { + mutt_message(_("Char = %s, Octal = %o, Decimal = %d"), + km_keyname(ch), ch, ch); } - while (ch != ERR && ch != '\033'); } - else - { - mutt_window_mvprintw (MuttMessageWindow, 0, 0, _("Enter keys (^G to abort): ")); - do { - ch = getch(); - if (ch != ERR && ch != ctrl ('G')) - { - mutt_message(_("Char = %s, Octal = %o, Decimal = %d"), - km_keyname(ch), ch, ch); - } - } - while (ch != ERR && ch != ctrl ('G')); - } + while (ch != ERR && ch != ctrl ('G')); mutt_flushinp(); mutt_clear_error();