<<< Date Index >>>     <<< Thread Index >>>

tag-invert



Hi.

22:31 <nyetzsche> is there a way to invert which files are tagged in a folder?
22:33 <init0> no afaik
22:37 <Myon> but you are right, that feature is missing
22:46 * Myon tries to implement that now
23:46 <Myon> nyetzsche: http://www.df7cb.de/projects/mutt/tag-invert/
23:50 <nyetzsche> Myon: thx

So, here it is.

The new <tag-invert> function toggles the tags in the index and other
menus. It is unbound per default.

Christoph
-- 
cb@xxxxxxxx | http://www.df7cb.de/
diff -urp MUTT/mutt/OPS tag-invert/mutt/OPS
--- MUTT/mutt/OPS       2003-07-04 19:07:22.000000000 +0200
+++ tag-invert/mutt/OPS 2005-01-20 23:43:11.000000000 +0100
@@ -156,6 +156,7 @@ OP_SHELL_ESCAPE "invoke a command in a s
 OP_SORT "sort messages"
 OP_SORT_REVERSE "sort messages in reverse order"
 OP_TAG "tag the current entry"
+OP_TAG_INVERT "toggle the tag on all entries"
 OP_TAG_PREFIX "apply next function to tagged messages"
 OP_TAG_PREFIX_COND "apply next function ONLY to tagged messages"
 OP_TAG_SUBTHREAD "tag the current subthread"
diff -urp MUTT/mutt/PATCHES tag-invert/mutt/PATCHES
--- MUTT/mutt/PATCHES   2002-12-09 18:44:54.000000000 +0100
+++ tag-invert/mutt/PATCHES     2005-01-20 23:44:22.000000000 +0100
@@ -0,0 +1 @@
+patch-1.5.6+CVS.cb.tag-invert.1
diff -urp MUTT/mutt/curs_main.c tag-invert/mutt/curs_main.c
--- MUTT/mutt/curs_main.c       2004-04-12 23:51:07.000000000 +0200
+++ tag-invert/mutt/curs_main.c 2005-01-20 23:34:06.000000000 +0100
@@ -941,6 +941,17 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
        }
        break;
 
+      case OP_TAG_INVERT:
+
+       CHECK_MSGCOUNT;
+        CHECK_VISIBLE;
+       for (j = 0; j < Context->msgcount; j++) {
+         mutt_set_flag (Context, Context->hdrs[j], M_TAG, 
!Context->hdrs[j]->tagged);
+           mutt_error _("tag-invert.");
+       }
+       menu->redraw = REDRAW_STATUS | REDRAW_INDEX;
+       break;
+
       case OP_MAIN_TAG_PATTERN:
 
        CHECK_MSGCOUNT;
diff -urp MUTT/mutt/doc/manual.sgml.tail tag-invert/mutt/doc/manual.sgml.tail
--- MUTT/mutt/doc/manual.sgml.tail      2005-01-15 20:27:12.000000000 +0100
+++ tag-invert/mutt/doc/manual.sgml.tail        2005-01-20 23:40:15.000000000 
+0100
@@ -42,6 +42,7 @@ search-reverse         ESC /   search ba
 select-entry             RET   select the current entry
 shell-escape               !   run a program in a subshell
 tag-entry                  t   toggle the tag on the current entry
+tag-invert         not bound   toggle the tag on all entries
 tag-prefix                 ;   apply next command to tagged entries
 tag-prefix-cond    not bound   apply next function ONLY to tagged messages
 top-page                   H   move to the top of the page
diff -urp MUTT/mutt/functions.h tag-invert/mutt/functions.h
--- MUTT/mutt/functions.h       2003-07-04 19:07:22.000000000 +0200
+++ tag-invert/mutt/functions.h 2005-01-20 22:50:54.000000000 +0100
@@ -40,6 +40,7 @@ struct binding_t OpGeneric[] = {
   { "search-next",     OP_SEARCH_NEXT,         "n" },
   { "exit",            OP_EXIT,                "q" },
   { "tag-entry",       OP_TAG,                 "t" },
+  { "tag-invert",      OP_TAG_INVERT,          NULL },
   { "next-page",       OP_NEXT_PAGE,           "z" },
   { "previous-page",   OP_PREV_PAGE,           "Z" },
   { "last-entry",      OP_LAST_ENTRY,          "*" },
diff -urp MUTT/mutt/menu.c tag-invert/mutt/menu.c
--- MUTT/mutt/menu.c    2004-09-04 13:31:21.000000000 +0200
+++ tag-invert/mutt/menu.c      2005-01-20 23:11:55.000000000 +0100
@@ -1030,6 +1030,22 @@ int mutt_menuLoop (MUTTMENU *menu)
          mutt_error _("Tagging is not supported.");
        break;
 
+      case OP_TAG_INVERT:
+       if (menu->tag && !menu->dialog)
+       {
+         if (menu->max)
+         {
+           for (i = 0; i < menu->max; i++)
+             menu->tagged += menu->tag (menu, i, -1);
+           menu->redraw = REDRAW_INDEX;
+         }
+         else
+           mutt_error _("No entries.");
+       }
+       else
+         mutt_error _("Tagging is not supported.");
+       break;
+
       case OP_SHELL_ESCAPE:
        mutt_shell_escape ();
        MAYBE_REDRAW (menu->redraw);

Attachment: signature.asc
Description: Digital signature