diff -udpr mutt-1.2.5.orig/Muttrc.head.in mutt-1.2.5/Muttrc.head.in --- mutt-1.2.5.orig/Muttrc.head.in Mon Mar 20 11:25:49 2000 +++ mutt-1.2.5/Muttrc.head.in Sun Apr 29 13:29:11 2001 @@ -14,11 +14,6 @@ macro index \eb '/~b ' 'search in messag macro index \cb |urlview\n 'call urlview to extract URLs out of a message' macro pager \cb |urlview\n 'call urlview to extract URLs out of a message' -# Show documentation when pressing F1 -macro generic "!less @docdir@/manual.txt\n" "Show Mutt documentation" -macro index "!less @docdir@/manual.txt\n" "Show Mutt documentation" -macro pager "!less @docdir@/manual.txt\n" "Show Mutt documentation" - # If Mutt is unable to determine your site's domain name correctly, you can # set the default here. # diff -udpr mutt-1.2.5.orig/OPS mutt-1.2.5/OPS --- mutt-1.2.5.orig/OPS Tue Feb 15 17:28:45 2000 +++ mutt-1.2.5/OPS Sun Apr 29 13:29:11 2001 @@ -113,6 +113,7 @@ OP_MAIN_SYNC_FOLDER "save changes to mai OP_MAIN_TAG_PATTERN "tag messages matching a pattern" OP_MAIN_UNDELETE_PATTERN "undelete messages matching a pattern" OP_MAIN_UNTAG_PATTERN "untag messages matching a pattern" +OP_MANUAL "show mutt documentation" OP_MIDDLE_PAGE "move to the middle of the page" OP_NEW_MAILBOX "create a new mailbox (IMAP only)" OP_NEXT_ENTRY "move to the next entry" diff -udpr mutt-1.2.5.orig/acconfig.h mutt-1.2.5/acconfig.h --- mutt-1.2.5.orig/acconfig.h Thu May 18 11:43:22 2000 +++ mutt-1.2.5/acconfig.h Sun Apr 29 13:29:11 2001 @@ -138,6 +138,9 @@ /* Where are the character set definitions located? */ #undef CHARMAPS_DIR +/* Where is the documentation located? */ +#undef MUTTDOCDIR + /* Define to `int' if doesn't define. */ #undef sig_atomic_t diff -udpr mutt-1.2.5.orig/config.h.in mutt-1.2.5/config.h.in --- mutt-1.2.5.orig/config.h.in Fri Jul 7 00:34:03 2000 +++ mutt-1.2.5/config.h.in Sun Apr 29 13:29:11 2001 @@ -58,6 +58,9 @@ /* Where to put l10n data */ #undef MUTTLOCALEDIR +/* Where is the documentation located? */ +#undef MUTTDOCDIR + /* Enable debugging info */ #undef DEBUG diff -udpr mutt-1.2.5.orig/configure.in mutt-1.2.5/configure.in --- mutt-1.2.5.orig/configure.in Fri Jul 28 20:50:24 2000 +++ mutt-1.2.5/configure.in Sun Apr 29 13:29:11 2001 @@ -412,6 +412,7 @@ AC_ARG_WITH(docdir, [ --with-docdir=PAT docdir=$mutt_cv_docdir AC_SUBST(docdir) +AC_DEFINE_UNQUOTED(MUTTDOCDIR, "$docdir") if test x$mutt_cv_setgid = xyes; then DOTLOCK_GROUP='mail' diff -udpr mutt-1.2.5.orig/curs_main.c mutt-1.2.5/curs_main.c --- mutt-1.2.5.orig/curs_main.c Tue Jul 25 10:02:26 2000 +++ mutt-1.2.5/curs_main.c Sun Apr 29 13:29:11 2001 @@ -725,6 +725,12 @@ int mutt_index_menu (void) menu->redraw = REDRAW_FULL; break; + case OP_MANUAL: + + mutt_manual (); + menu->redraw = REDRAW_FULL; + break; + case OP_MAIN_SHOW_LIMIT: CHECK_MSGCOUNT; if (!Context->pattern) diff -udpr mutt-1.2.5.orig/functions.h mutt-1.2.5/functions.h --- mutt-1.2.5.orig/functions.h Fri Mar 3 11:10:08 2000 +++ mutt-1.2.5/functions.h Sun Apr 29 13:29:11 2001 @@ -50,6 +50,7 @@ struct binding_t OpGeneric[] = { { "half-up", OP_HALF_UP, "[" }, { "half-down", OP_HALF_DOWN, "]" }, { "help", OP_HELP, "?" }, + { "manual", OP_MANUAL, "" }, { "tag-prefix", OP_TAG_PREFIX, ";" }, { "shell-escape", OP_SHELL_ESCAPE, "!" }, { "select-entry", OP_GENERIC_SELECT_ENTRY,M_ENTER_S }, @@ -197,6 +198,7 @@ struct binding_t OpPager[] = { { "next-new", OP_MAIN_NEXT_NEW, "\t" }, { "pipe-message", OP_PIPE, "|" }, { "help", OP_HELP, "?" }, + { "manual", OP_MANUAL, "" }, { "next-page", OP_NEXT_PAGE, " " }, { "previous-page", OP_PREV_PAGE, "-" }, { "top", OP_PAGER_TOP, "^" }, diff -udpr mutt-1.2.5.orig/help.c mutt-1.2.5/help.c --- mutt-1.2.5.orig/help.c Fri Mar 3 11:10:08 2000 +++ mutt-1.2.5/help.c Sun Apr 29 13:29:11 2001 @@ -299,6 +299,49 @@ static void dump_unbound (FILE *f, } } +extern short InHelp; + +void mutt_manual() +{ + char tmp[_POSIX_PATH_MAX]; + char buf[_POSIX_PATH_MAX]; + FILE *fdin, *fdout; + + snprintf (buf, sizeof(buf), "%s/%s", MUTTDOCDIR, "manual.txt"); + mutt_mktemp (tmp); + + if ( (fdin=safe_fopen (buf, "r")) == NULL ) { + mutt_error _("Error trying to view file"); + return; + } + + if ( (fdout=safe_fopen (tmp, "w")) == NULL ) { + fclose (fdin); + mutt_error _("Error trying to view file"); + return; + } + + if ( mutt_copy_stream (fdin, fdout) ) { + fclose (fdin); + fclose (fdout); + mutt_error _("Error trying to view file"); + return; + } + + fclose (fdin); + fclose (fdout); + + InHelp |= 2; + + snprintf (buf, sizeof(buf), + _("Manual for Mutt %s: %s/%s"), VERSION, MUTTDOCDIR, "manual.txt"); + mutt_do_pager (buf, tmp, + M_PAGER_MESSAGE, + NULL); + + InHelp &= ~2; +} + void mutt_help (int menu) { char t[_POSIX_PATH_MAX]; @@ -314,10 +357,12 @@ void mutt_help (int menu) if (!desc) desc = _(""); + InHelp |= 1; do { if ((f = safe_fopen (t, "w")) == NULL) { mutt_perror (t); + InHelp &= ~1; return; } @@ -343,4 +388,5 @@ void mutt_help (int menu) M_PAGER_RETWINCH | M_PAGER_MARKER | M_PAGER_NSKIP, NULL) == OP_REFORMAT_WINCH); + InHelp &= ~1; } diff -udpr mutt-1.2.5.orig/menu.c mutt-1.2.5/menu.c --- mutt-1.2.5.orig/menu.c Fri Mar 3 11:10:10 2000 +++ mutt-1.2.5/menu.c Sun Apr 29 13:29:11 2001 @@ -959,6 +959,11 @@ int mutt_menuLoop (MUTTMENU *menu) menu->redraw = REDRAW_FULL; break; + case OP_MANUAL: + mutt_manual (); + menu->redraw = REDRAW_FULL; + break; + case OP_NULL: km_error_key (menu->menu); break; diff -udpr mutt-1.2.5.orig/pager.c mutt-1.2.5/pager.c --- mutt-1.2.5.orig/pager.c Sat Apr 22 10:25:20 2000 +++ mutt-1.2.5/pager.c Sun Apr 29 13:29:11 2001 @@ -125,7 +125,7 @@ typedef struct _ansi_attr { int pair; } ansi_attr; -static short InHelp = 0; +short InHelp = 0; #if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) static struct resize { @@ -704,7 +704,7 @@ resolve_types (char *buf, struct line_t regmatch_t pmatch[1], smatch[1]; int found, offset, null_rx, i; - if (n == 0 || ISHEADER (lineInfo[n-1].type)) + if ( (n == 0 || ISHEADER (lineInfo[n-1].type)) && InHelp==0 ) { if (buf[0] == '\n') lineInfo[n].type = MT_COLOR_NORMAL; @@ -1477,12 +1477,18 @@ mutt_pager (const char *banner, const ch strcat (helpstr, " "); strcat (helpstr, buffer); } - if (!InHelp) + if (InHelp==0) { mutt_make_help (buffer, sizeof (buffer), _("Help"), MENU_PAGER, OP_HELP); strcat (helpstr, " "); strcat (helpstr, buffer); } + if (InHelp==1) + { + mutt_make_help (buffer, sizeof (buffer), _("Manual"), MENU_PAGER, OP_HELP); + strcat (helpstr, " "); + strcat (helpstr, buffer); + } while (ch != -1) { @@ -1976,12 +1982,19 @@ mutt_pager (const char *banner, const ch case OP_HELP: /* don't let the user enter the help-menu from the help screen! */ - if (! InHelp) + if (InHelp<1) { - InHelp = 1; mutt_help (MENU_PAGER); redraw = REDRAW_FULL; - InHelp = 0; + break; + } + /* Fall through! */ + + case OP_MANUAL: + if (InHelp<2) + { + mutt_manual (); + redraw = REDRAW_FULL; } else mutt_error _("Help is currently being shown."); diff -udpr mutt-1.2.5.orig/protos.h mutt-1.2.5/protos.h --- mutt-1.2.5.orig/protos.h Tue May 16 17:23:12 2000 +++ mutt-1.2.5/protos.h Sun Apr 29 13:29:11 2001 @@ -162,6 +162,7 @@ void mutt_free_header (HEADER **); void mutt_free_parameter (PARAMETER **); void mutt_generate_header (char *, size_t, HEADER *, int); void mutt_help (int); +void mutt_manual (void); void mutt_linearize_tree (CONTEXT *, int); void mutt_make_attribution (CONTEXT *ctx, HEADER *cur, FILE *out); void mutt_make_forward_subject (ENVELOPE *env, CONTEXT *ctx, HEADER *cur);