The attached patch copies the functionality of the display-address function
to display the message subject, by default bound to S.  This is useful if
your term isn't infinitely wide and/or you have a crowded $index_format.

I've been using a version of this since 1.3.2x without any problems; it's
pretty much just a copy of the display-address stuff so it should be pretty
innocuous.
diff -dupr mutt-cvs.orig/PATCHES mutt-cvs/PATCHES
--- mutt-cvs.orig/PATCHES       Wed Sep 11 23:05:23 2002
+++ mutt-cvs/PATCHES    Wed Sep 11 23:26:04 2002
@@ -0,0 +1 @@
+patch-1.5.jjb.display_subject.1
diff -dupr mutt-cvs.orig/OPS mutt-cvs/OPS
--- mutt-cvs.orig/OPS   Wed Sep 11 23:05:23 2002
+++ mutt-cvs/OPS        Wed Sep 11 23:26:04 2002
@@ -53,6 +53,7 @@ OP_DELETE_MAILBOX "delete the current ma
 OP_DELETE_SUBTHREAD "delete all messages in subthread"
 OP_DELETE_THREAD "delete all messages in thread"
 OP_DISPLAY_ADDRESS "display full address of sender"
+OP_DISPLAY_SUBJECT "display full subject of message"
 OP_DISPLAY_HEADERS "display message and toggle header weeding"
 OP_DISPLAY_MESSAGE "display a message"
 OP_EDIT_MESSAGE "edit the raw message"
diff -dupr mutt-cvs.orig/PATCHES mutt-cvs/PATCHES
--- mutt-cvs.orig/PATCHES       Thu Jan 24 06:10:47 2002
+++ mutt-cvs/PATCHES    Wed Sep 11 23:26:04 2002
@@ -0,0 +1 @@
+patch-1.3.25.jjb.display_subject.1
diff -dupr mutt-cvs.orig/commands.c mutt-cvs/commands.c
--- mutt-cvs.orig/commands.c    Sat Apr 20 12:30:38 2002
+++ mutt-cvs/commands.c Wed Sep 11 23:26:04 2002
@@ -619,6 +619,11 @@ void mutt_display_address (ENVELOPE *env
   mutt_message ("%s: %s", pfx, buf);
 }
 
+void mutt_display_subject (ENVELOPE *env)
+{
+  mutt_message ("Subject: %s", env->subject);
+}
+
 static void set_copy_flags (HEADER *hdr, int decode, int decrypt, int *cmflags, int 
*chflags)
 {
   *cmflags = 0;
diff -dupr mutt-cvs.orig/curs_main.c mutt-cvs/curs_main.c
--- mutt-cvs.orig/curs_main.c   Wed Sep 11 23:05:23 2002
+++ mutt-cvs/curs_main.c        Wed Sep 11 23:26:04 2002
@@ -1687,8 +1687,15 @@ int mutt_index_menu (void)
       case OP_DISPLAY_ADDRESS:
 
        CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
+       CHECK_VISIBLE;
        mutt_display_address (CURHDR->env);
+       break;
+
+      case OP_DISPLAY_SUBJECT:
+
+       CHECK_MSGCOUNT;
+       CHECK_VISIBLE;
+       mutt_display_subject (CURHDR->env);
        break;
 
       case OP_ENTER_COMMAND:
diff -dupr mutt-cvs.orig/doc/manual.sgml.tail mutt-cvs/doc/manual.sgml.tail
--- mutt-cvs.orig/doc/manual.sgml.tail  Fri Jun 14 08:17:22 2002
+++ mutt-cvs/doc/manual.sgml.tail       Wed Sep 11 23:26:04 2002
@@ -62,6 +62,7 @@ delete-pattern             D   delete me
 delete-subthread       ESC d   delete all messages in subthread
 delete-thread             ^D   delete all messages in thread
 display-address            @   display full address of sender
+display-subject            S   display full subject of message
 display-toggle-weed        h   display message and toggle header weeding
 display-message          RET   display a message
 edit                       e   edit the current message
@@ -132,6 +133,7 @@ delete-message             d   delete th
 delete-subthread       ESC d   delete all messages in subthread
 delete-thread             ^D   delete all messages in thread
 display-address            @   display full address of sender
+display-subject            S   display full subject of message
 display-toggle-weed        h   display message and toggle header weeding
 edit                       e   edit the current message
 edit-type                 ^E   edit the current message's Content-Type
diff -dupr mutt-cvs.orig/functions.h mutt-cvs/functions.h
--- mutt-cvs.orig/functions.h   Wed Sep 11 23:05:23 2002
+++ mutt-cvs/functions.h        Wed Sep 11 23:26:04 2002
@@ -128,6 +128,7 @@ struct binding_t OpMain[] = {
   { "buffy-list",              OP_BUFFY_LIST,                  "." },
   { "sync-mailbox",            OP_MAIN_SYNC_FOLDER,            "$" },
   { "display-address",         OP_DISPLAY_ADDRESS,             "@" },
+  { "display-subject",         OP_DISPLAY_SUBJECT,             "S" },
   { "pipe-message",            OP_PIPE,                        "|" },
   { "next-new",                        OP_MAIN_NEXT_NEW,               "\t" },
   { "previous-new",            OP_MAIN_PREV_NEW,               "\033\t" },
@@ -204,6 +205,7 @@ struct binding_t OpPager[] = {
   { "show-version",    OP_VERSION,                     "V" },
   { "search-toggle",   OP_SEARCH_TOGGLE,               "\\" },
   { "display-address", OP_DISPLAY_ADDRESS,             "@" },
+  { "display-subject", OP_DISPLAY_SUBJECT,             "S" },
   { "next-new",                OP_MAIN_NEXT_NEW,               "\t" },
   { "pipe-message",    OP_PIPE,                        "|" },
   { "help",            OP_HELP,                        "?" },
diff -dupr mutt-cvs.orig/pager.c mutt-cvs/pager.c
--- mutt-cvs.orig/pager.c       Wed Sep 11 23:05:24 2002
+++ mutt-cvs/pager.c    Wed Sep 11 23:26:04 2002
@@ -2203,6 +2203,14 @@ mutt_pager (const char *banner, const ch
          mutt_display_address (extra->hdr->env);
        break;
 
+      case OP_DISPLAY_SUBJECT:
+       CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
+        if (IsMsgAttach (extra))
+         mutt_display_subject (extra->bdy->hdr->env);
+        else
+         mutt_display_subject (extra->hdr->env);
+       break;
+
       case OP_ENTER_COMMAND:
        old_smart_wrap = option (OPTWRAP);
        old_markers = option (OPTMARKERS);
diff -dupr mutt-cvs.orig/protos.h mutt-cvs/protos.h
--- mutt-cvs.orig/protos.h      Wed Sep 11 23:05:24 2002
+++ mutt-cvs/protos.h   Wed Sep 11 23:26:04 2002
@@ -158,6 +158,7 @@ void mutt_decode_attachment (BODY *, STA
 void mutt_decode_base64 (STATE *s, long len, int istext, iconv_t cd);
 void mutt_default_save (char *, size_t, HEADER *);
 void mutt_display_address (ENVELOPE *);
+void mutt_display_subject (ENVELOPE *);
 void mutt_display_sanitize (char *);
 void mutt_edit_content_type (HEADER *, BODY *, FILE *);
 void mutt_edit_file (const char *, const char *);

Attachment: msg30906/pgp00000.pgp
Description: PGP signature

Reply via email to