From 4956e966dd7544b1438b98350af3c4a3709b4986 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 15 Mar 2007 01:07:08 +0100 Subject: [PATCH] Generate menu binding documentation from functions.h and OPS*. --- doc/Makefile.am | 8 +- doc/gen-map-doc | 55 +++++++ doc/manual.xml.tail | 377 +++++++++----------------------------------- functions.h | 26 +-- 4 files changed, 150 insertions(+), 316 deletions(-) create mode 100644 doc/gen-map-doc diff --git a/doc/Makefile.am b/doc/Makefile.am index 32978de4f..e8504770b 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -132,11 +132,13 @@ EDIT = sed -e 's,@sysconfdir\@,$(sysconfdir),g' \ mutt.1: $(srcdir)/mutt.man $(EDIT) $(srcdir)/mutt.man > $@ -stamp-doc-xml: $(top_srcdir)/makedoc.c $(top_srcdir)/init.h manual.xml.head manual.xml.tail \ +stamp-doc-xml: $(top_srcdir)/makedoc.c $(top_srcdir)/init.h manual.xml.head \ + $(top_srcdir)/functions.h $(wildcard $(top_srcdir)/OPS*) manual.xml.tail \ $(top_srcdir)/VERSION ../reldate.h $(MAKE) ../makedoc$(EXEEXT) ( date=`cut -d\" -f2 ../reldate.h`; \ sed -e "s/@VERSION\@/`cat $(top_srcdir)/VERSION` ($$date)/" $(srcdir)/manual.xml.head ;\ - $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s ) | \ - cat - $(srcdir)/manual.xml.tail > manual.xml + $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s ;\ + ./gen-map-doc $(top_srcdir)/functions.h $(wildcard $(top_srcdir)/OPS*) < $(srcdir)/manual.xml.tail \ + ) > manual.xml touch stamp-doc-xml diff --git a/doc/gen-map-doc b/doc/gen-map-doc new file mode 100644 index 000000000..9e01cc01e --- /dev/null +++ b/doc/gen-map-doc @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w + +use strict; + +my (%OPS, %MAP, $map); + +my $functions_h = shift @ARGV; + +open F, "cat @ARGV |" or die "OPS*: $!"; +while () { + /(\w+) "(.+)"/ or die "$.: parse error"; + $OPS{$1} = $2; +} +close F; + +open F, $functions_h or die "$functions_h: $!"; +while () { + if (/^struct binding_t Op.*{ \/\* map: (.*) \*\//) { + $map = $1; + } + if ($map and /{\s*"(.+)"\s*,\s*(\w+)\s*,\s*(?:"([^"]+)"|(\w+))\s*}/) { + my ($function, $op, $binding) = ($1, $2, $3 || $4); + $binding =~ s/ /Space/; + $binding =~ s/^\\033/ESC /; + $binding =~ s/^\\010/Backspace/; + $binding =~ s/^\\(0\d+)$/'^'.chr(64+oct($1))/e; + $binding =~ s/^\\(0\d+)(.)/'^'.chr(64+oct($1)) ." $2"/e; + $binding =~ s/<(.+)>/$1/; + $binding =~ s/&/&/; + $binding =~ s//>/; + $binding =~ s/\\t/TAB/; + $binding =~ s/M_ENTER_S/RET/; + $binding =~ s/NULL/not bound/; + die "unknown key $binding" if $binding =~ /\\[^\\]|<|>/; + die "unknown OP $op" unless $OPS{$op}; + $MAP{$map} .= "$function$binding$OPS{$op}\n"; + } + if ($map and /^}/) { + undef $map; + } +} +close F; + +while () { + if (/__print_map\((.*)\)/) { + die "map $1 undefined" unless $MAP{$1}; + print $MAP{$1}; + delete $MAP{$1}; + } else { + print; + } +} + +die "unprinted maps: ". join(" ", keys %MAP) if %MAP; diff --git a/doc/manual.xml.tail b/doc/manual.xml.tail index 631d2de25..7bba58c24 100644 --- a/doc/manual.xml.tail +++ b/doc/manual.xml.tail @@ -11,7 +11,7 @@ functions can be changed with the bind command. - + generic @@ -23,44 +23,14 @@ bindings for all menus (except as noted). - +
Default generic function bindings FunctionDefault keyDescription -bottom-pageLmove to the bottom of the page -current-bottomnot boundmove current entry to bottom of page -current-middlenot boundmove current entry to middle of page -current-topnot boundmove current entry to top of page -enter-command:enter a muttrc command -exitqexit this menu -first-entry=move to the first entry -half-down]scroll down 1/2 page -half-up[scroll up 1/2 page -help?this screen -jumpnumberjump to an index number -last-entry*move to the last entry -middle-pageMmove to the middle of the page -next-entryjmove to the next entry -next-line>scroll down one line -next-pagezmove to the next page -previous-entrykmove to the previous entry -previous-line<scroll up one line -previous-pageZmove to the previous page -refreshˆLclear and redraw the screen -search/search for a regular expression -search-nextnsearch for next match -search-oppositenot boundsearch for next match in opposite direction -search-reverseESC /search backwards for a regular expression -select-entryRETselect the current entry -shell-escape!run a program in a subshell -tag-entryttoggle the tag on the current entry -tag-prefix;apply next command to tagged entries -tag-prefix-condnot boundapply next function ONLY to tagged messages -top-pageHmove to the top of the page -what-keynot bounddisplay the keycode for a key press +__print_map(generic)
@@ -69,87 +39,19 @@ bindings for all menus (except as noted).
- + index - +
Default index menu function bindings FunctionDefault keyDescription -bounce-messagebremail a message to another user -change-foldercopen a different folder -change-folder-readonlyESC copen a different folder in read only mode -check-traditional-pgpESC Pcheck for classic PGP -clear-flagWclear a status flag from a message -copy-messageCcopy a message to a file/mailbox -create-aliasacreate an alias from a message sender -decode-copyESC Cdecode a message and copy it to a file/mailbox -decode-saveESC sdecode a message and save it to a file/mailbox -delete-messageddelete the current entry -delete-patternDdelete messages matching a pattern -delete-subthreadESC ddelete all messages in subthread -delete-threadˆDdelete all messages in thread -display-address@display full address of sender -display-toggle-weedhdisplay message and toggle header weeding -display-messageRETdisplay a message -editeedit the current message -edit-typeˆEedit the current message's Content-Type -exitxexit without saving changes -extract-keysˆKextract PGP public keys -fetch-mailGretrieve mail from POP server -flag-messageFtoggle a message's 'important' flag -forget-passphraseˆFwipe PGP passphrase from memory -forward-messagefforward a message with comments -group-replygreply to all recipients -limitlshow only messages matching a pattern -list-replyLreply to specified mailing list -mailmcompose a new mail message -mail-keyESC kmail a PGP public key -next-newnot boundjump to the next new message -next-new-then-unreadTABjump to the next new or unread message -next-subthreadESC njump to the next subthread -next-threadˆNjump to the next thread -next-undeletedjmove to the next undeleted message -next-unreadnot boundjump to the next unread message -parent-messagePjump to parent message in thread -pipe-message|pipe message/attachment to a shell command -previous-newnot boundjump to the previous new message -previous-new-then-unreadESC TABjump to the previous new or unread message -previous-pageZmove to the previous page -previous-subthreadESC pjump to previous subthread -previous-threadˆPjump to previous thread -previous-undeletedkmove to the last undelete message -previous-unreadnot boundjump to the previous unread message -print-messagepprint the current entry -queryQquery external program for addresses -quitqsave changes to mailbox and quit -read-subthreadESC rmark the current subthread as read -read-threadˆRmark the current thread as read -recall-messageRrecall a postponed message -replyrreply to a message -resend-messageESC eresend message and preserve MIME structure -save-messagessave message/attachment to a file -set-flagwset a status flag on a message -show-versionVshow the Mutt version number and date -show-limitESC lshow currently active limit pattern, if any -sort-mailboxosort messages -sort-reverseOsort messages in reverse order -sync-mailbox$save changes to mailbox -tag-patternTtag messages matching a pattern -tag-threadESC ttag/untag all messages in the current thread -toggle-newNtoggle a message's 'new' flag -toggle-write%toggle whether the mailbox will be rewritten -undelete-messageuundelete the current entry -undelete-patternUundelete messages matching a pattern -undelete-subthreadESC uundelete all messages in subthread -undelete-threadˆUundelete all messages in thread -untag-patternˆTuntag messages matching a pattern -view-attachmentsvshow MIME attachments +__print_map(index)
@@ -158,92 +60,19 @@ bindings for all menus (except as noted).
- + pager - +
Default pager menu function bindings FunctionDefault keyDescription -bottomnot boundjump to the bottom of the message -bounce-messagebremail a message to another user -change-foldercopen a different folder -change-folder-readonlyESC copen a different folder in read only mode -check-traditional-pgpESC Pcheck for classic PGP -copy-messageCcopy a message to a file/mailbox -create-aliasacreate an alias from a message sender -decode-copyESC Cdecode a message and copy it to a file/mailbox -decode-saveESC sdecode a message and save it to a file/mailbox -delete-messageddelete the current entry -delete-subthreadESC ddelete all messages in subthread -delete-threadˆDdelete all messages in thread -display-address@display full address of sender -display-toggle-weedhdisplay message and toggle header weeding -editeedit the current message -edit-typeˆEedit the current message's Content-Type -enter-command:enter a muttrc command -exitireturn to the main-menu -extract-keysˆKextract PGP public keys -flag-messageFtoggle a message's 'important' flag -forget-passphraseˆFwipe PGP passphrase from memory -forward-messagefforward a message with comments -group-replygreply to all recipients -half-upnot boundmove up one-half page -half-downnot boundmove down one-half page -help?this screen -list-replyLreply to specified mailing list -mailmcompose a new mail message -mail-keyESC kmail a PGP public key -mark-as-newNtoggle a message's 'new' flag -next-lineRETscroll down one line -next-entryJmove to the next entry -next-newnot boundjump to the next new message -next-new-then-unreadTABjump to the next new or unread message -next-pagenot boundmove to the next page -next-subthreadESC njump to the next subthread -next-threadˆNjump to the next thread -next-undeletedjmove to the next undeleted message -next-unreadnot boundjump to the next unread message -parent-messagePjump to parent message in thread -pipe-message|pipe message/attachment to a shell command -previous-lineBackSpacescroll up one line -previous-entryKmove to the previous entry -previous-newnot boundjump to the previous new message -previous-new-then-unreadnot boundjump to the previous new message -previous-page-move to the previous page -previous-subthreadESC pjump to previous subthread -previous-threadˆPjump to previous thread -previous-undeletedkmove to the last undelete message -previous-unreadnot boundjump to the previous unread message -print-messagepprint the current entry -quitQsave changes to mailbox and quit -read-subthreadESC rmark the current subthread as read -read-threadˆRmark the current thread as read -recall-messageRrecall a postponed message -redraw-screenˆLclear and redraw the screen -replyrreply to a message -save-messagessave message/attachment to a file -search/search for a regular expression -search-nextnsearch for next match -search-oppositenot boundsearch for next match in opposite direction -search-reverseESC /search backwards for a regular expression -search-toggle\toggle search pattern coloring -shell-escape!invoke a command in a subshell -show-versionVshow the Mutt version number and date -skip-quotedSskip beyond quoted text -sync-mailbox$save changes to mailbox -tag-messagettag a message -toggle-quotedTtoggle display of quoted text -topˆjump to the top of the message -undelete-messageuundelete the current entry -undelete-subthreadESC uundelete all messages in subthread -undelete-threadˆUundelete all messages in thread -view-attachmentsvshow MIME attachments +__print_map(pager)
@@ -252,21 +81,19 @@ bindings for all menus (except as noted).
- + alias - +
Default alias menu function bindings FunctionDefault keyDescription -search/search for a regular expression -search-nextnsearch for next match -search-reverseESC /search backwards for a regular expression +__print_map(alias)
@@ -275,26 +102,19 @@ bindings for all menus (except as noted).
- + query - +
Default query menu function bindings FunctionDefault keyDescription -create-aliasacreate an alias from a message sender -mailmcompose a new mail message -queryQquery external program for addresses -query-appendAappend new query results to current results -search/search for a regular expression -search-nextnsearch for next match -search-oppositenot boundsearch for next match in opposite direction -search-reverseESC /search backwards for a regular expression +__print_map(query)
@@ -303,36 +123,19 @@ bindings for all menus (except as noted).
- + attach - +
Default attach menu function bindings FunctionDefault keyDescription -bounce-messagebremail a message to another user -collapse-partsvtoggle display of subparts -delete-entryddelete the current entry -display-toggle-weedhdisplay message and toggle header weeding -edit-typeˆEedit the current entry's Content-Type -extract-keysˆKextract PGP public keys -forward-messagefforward a message with comments -group-replygreply to all recipients -list-replyLreply to specified mailing list -pipe-entry|pipe message/attachment to a shell command -print-entrypprint the current entry -replyrreply to a message -resend-messageESC eresend message and preserve MIME structure -save-entryssave message/attachment to a file -undelete-entryuundelete the current entry -view-attachRETview attachment using mailcap entry if necessary -view-mailcapmforce viewing of attachment using mailcap -view-textTview attachment as text +__print_map(attach)
@@ -341,51 +144,19 @@ bindings for all menus (except as noted).
- + compose - +
Default compose menu function bindings FunctionDefault keyDescription -attach-fileaattach a file(s) to this message -attach-messageAattach message(s) to this message -attach-keyESC kattach a PGP public key -copy-fileCsave message/attachment to a file -detach-fileDdelete the current entry -display-toggle-weedhdisplay message and toggle header weeding -edit-bccbedit the BCC list -edit-cccedit the CC list -edit-descriptiondedit attachment description -edit-encodingˆEedit attachment transfer-encoding -edit-fccfenter a file to save a copy of this message in -edit-fromESC fedit the from: field -edit-fileˆX eedit the file to be attached -edit-headersEedit the message with headers -editeedit the message -edit-mimemedit attachment using mailcap entry -edit-reply-toredit the Reply-To field -edit-subjectsedit the subject of this message -edit-totedit the TO list -edit-typeˆTedit attachment type -filter-entryFfilter attachment through a shell command -forget-passphraseˆFwipe PGP passphrase from memory -ispellirun ispell on the message -new-mimencompose new attachment using mailcap entry -pgp-menupshow PGP options -pipe-entry|pipe message/attachment to a shell command -postpone-messagePsave this message to send later -print-entrylprint the current entry -rename-fileRrename/move an attached file -send-messageysend the message -toggle-unlinkutoggle whether to delete file after sending it -view-attachRETview attachment using mailcap entry if necessary -write-fccwwrite the message to a folder +__print_map(compose)
@@ -394,20 +165,19 @@ bindings for all menus (except as noted).
- + postpone - +
Default postpone menu function bindings FunctionDefault keyDescription -delete-entryddelete the current entry -undelete-entryuundelete the current entry +__print_map(postpone)
@@ -416,32 +186,19 @@ bindings for all menus (except as noted).
- + browser - +
Default browser menu function bindings FunctionDefault keyDescription -change-dircchange directories -check-newTABcheck mailboxes for new mail -enter-maskmenter a file mask -search/search for a regular expression -search-nextnsearch for next match -search-reverseESC /search backwards for a regular expression -select-newNselect a new file in this directory -sortosort messages -sort-reverseOsort messages in reverse order -toggle-mailboxesTABtoggle whether to browse mailboxes or all files -view-fileSPACEview file -subscribessubscribe to current mailbox (IMAP Only) -unsubscribeuunsubscribe from current mailbox (IMAP Only) -toggle-subscribedTtoggle view all/subscribed mailboxes (IMAP Only) +__print_map(browser)
@@ -450,20 +207,19 @@ bindings for all menus (except as noted).
- -PGP + +pgp - -Default PGP menu function bindings +
+Default pgp menu function bindings FunctionDefault keyDescription -view-name%view the key's user id -verify-keycverify a PGP public key +__print_map(pgp)
@@ -472,40 +228,61 @@ bindings for all menus (except as noted).
- + +smime + + + + +Default smime menu function bindings + + +FunctionDefault keyDescription + + +__print_map(smime) + + +
+ +
+ +
+ + +mix + + + + +Default mix menu function bindings + + +FunctionDefault keyDescription + + +__print_map(mix) + + +
+ +
+ +
+ + editor - +
Default editor function bindings FunctionDefault keyDescription -backspaceBackSpacedelete the char in front of the cursor -backward-charˆBmove the cursor one character to the left -backward-wordESC bmove the cursor to the previous word -bolˆAjump to the beginning of the line -buffy-cycleSpacecycle among incoming mailboxes -capitalize-wordESC cuppercase the first character in the word -completeTABcomplete filename or alias -complete-queryˆTcomplete address with query -delete-charˆDdelete the char under the cursor -downcase-wordESC llowercase all characters in current word -eolˆEjump to the end of the line -forward-charˆFmove the cursor one character to the right -forward-wordESC fmove the cursor to the next word -history-downnot boundscroll down through the history list -history-upnot boundscroll up through the history list -kill-eolˆKdelete chars from cursor to end of line -kill-eowESC ddelete chars from cursor to end of word -kill-lineˆUdelete all chars on the line -kill-wordˆWdelete the word in front of the cursor -quote-charˆVquote the next typed key -transpose-charsnot boundtranspose character under cursor with previous -upcase-wordESC uuppercase all characters in current word +__print_map(editor)
diff --git a/functions.h b/functions.h index 3c33be013..237e7af15 100644 --- a/functions.h +++ b/functions.h @@ -30,7 +30,7 @@ * */ -struct binding_t OpGeneric[] = { +struct binding_t OpGeneric[] = { /* map: generic */ { "top-page", OP_TOP_PAGE, "H" }, { "next-entry", OP_NEXT_ENTRY, "j" }, { "previous-entry", OP_PREV_ENTRY, "k" }, @@ -66,7 +66,7 @@ struct binding_t OpGeneric[] = { { NULL, 0, NULL } }; -struct binding_t OpMain[] = { +struct binding_t OpMain[] = { /* map: index */ { "create-alias", OP_CREATE_ALIAS, "a" }, { "bounce-message", OP_BOUNCE_MESSAGE, "b" }, { "break-thread", OP_MAIN_BREAK_THREAD, "#" }, @@ -154,7 +154,7 @@ struct binding_t OpMain[] = { { NULL, 0, NULL } }; -struct binding_t OpPager[] = { +struct binding_t OpPager[] = { /* map: pager */ { "break-thread", OP_MAIN_BREAK_THREAD, "#" }, { "create-alias", OP_CREATE_ALIAS, "a" }, { "bounce-message", OP_BOUNCE_MESSAGE, "b" }, @@ -250,7 +250,7 @@ struct binding_t OpPager[] = { { NULL, 0, NULL } }; -struct binding_t OpAttach[] = { +struct binding_t OpAttach[] = { /* map: attach */ { "bounce-message", OP_BOUNCE_MESSAGE, "b" }, { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" }, { "edit-type", OP_EDIT_TYPE, "\005" }, @@ -276,7 +276,7 @@ struct binding_t OpAttach[] = { { NULL, 0, NULL } }; -struct binding_t OpCompose[] = { +struct binding_t OpCompose[] = { /* map: compose */ { "attach-file", OP_COMPOSE_ATTACH_FILE, "a" }, { "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" }, { "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" }, @@ -326,13 +326,13 @@ struct binding_t OpCompose[] = { { NULL, 0, NULL } }; -struct binding_t OpPost[] = { +struct binding_t OpPost[] = { /* map: postpone */ { "delete-entry", OP_DELETE, "d" }, { "undelete-entry", OP_UNDELETE, "u" }, { NULL, 0, NULL } }; -struct binding_t OpAlias[] = { +struct binding_t OpAlias[] = { /* map: alias */ { "delete-entry", OP_DELETE, "d" }, { "undelete-entry", OP_UNDELETE, "u" }, { NULL, 0, NULL } @@ -340,7 +340,7 @@ struct binding_t OpAlias[] = { /* The file browser */ -struct binding_t OpBrowser[] = { +struct binding_t OpBrowser[] = { /* map: browser */ { "change-dir", OP_CHANGE_DIRECTORY, "c" }, { "display-filename", OP_BROWSER_TELL, "@" }, { "enter-mask", OP_ENTER_MASK, "m" }, @@ -363,7 +363,7 @@ struct binding_t OpBrowser[] = { }; /* External Query Menu */ -struct binding_t OpQuery[] = { +struct binding_t OpQuery[] = { /* map: query */ { "create-alias", OP_CREATE_ALIAS, "a" }, { "mail", OP_MAIL, "m" }, { "query", OP_QUERY, "Q" }, @@ -371,7 +371,7 @@ struct binding_t OpQuery[] = { { NULL, 0, NULL } }; -struct binding_t OpEditor[] = { +struct binding_t OpEditor[] = { /* map: editor */ { "bol", OP_EDITOR_BOL, "\001" }, { "backward-char", OP_EDITOR_BACKWARD_CHAR, "\002" }, { "backward-word", OP_EDITOR_BACKWARD_WORD, "\033b"}, @@ -399,7 +399,7 @@ struct binding_t OpEditor[] = { -struct binding_t OpPgp[] = { +struct binding_t OpPgp[] = { /* map: pgp */ { "verify-key", OP_VERIFY_KEY, "c" }, { "view-name", OP_VIEW_ID, "%" }, { NULL, 0, NULL } @@ -409,7 +409,7 @@ struct binding_t OpPgp[] = { /* When using the GPGME based backend we have some useful functions for the SMIME menu. */ -struct binding_t OpSmime[] = { +struct binding_t OpSmime[] = { /* map: smime */ #ifdef CRYPT_BACKEND_GPGME { "verify-key", OP_VERIFY_KEY, "c" }, { "view-name", OP_VIEW_ID, "%" }, @@ -420,7 +420,7 @@ struct binding_t OpSmime[] = { #ifdef MIXMASTER -struct binding_t OpMix[] = { +struct binding_t OpMix[] = { /* map: mix */ { "accept", OP_MIX_USE, M_ENTER_S }, { "append", OP_MIX_APPEND, "a" }, { "insert", OP_MIX_INSERT, "i" }, -- 2.40.0