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

Re: tag-push and tag-pop for tag-prefixing macros



* Nicolas Rachinsky <mutt-devel-0@xxxxxxxxxxxxxxxxxxxxxx> [2006-01-15 21:15 
+0100]:
> Wow, thanks. I've written a similar patch, too.

And, of course, I forgot to attach it. :(

Nicolas

-- 
http://www.rachinsky.de/nicolas
diff -r -u mutt-1.5.11.orig/OPS mutt-1.5.11/OPS
--- mutt-1.5.11.orig/OPS        Sun Jan 15 21:16:15 2006
+++ mutt-1.5.11/OPS     Sun Jan 15 21:16:18 2006
@@ -163,6 +163,8 @@
 OP_TAG_PREFIX_COND "apply next function ONLY to tagged messages"
 OP_TAG_SUBTHREAD "tag the current subthread"
 OP_TAG_THREAD "tag the current thread"
+OP_SET_TAGFLAG "foo"
+OP_USE_TAGFLAG "bar"
 OP_TOGGLE_NEW "toggle a message's 'new' flag"
 OP_TOGGLE_WRITE "toggle whether the mailbox will be rewritten"
 OP_TOGGLE_MAILBOXES "toggle whether to browse mailboxes or all files"
diff -r -u mutt-1.5.11.orig/curs_main.c mutt-1.5.11/curs_main.c
--- mutt-1.5.11.orig/curs_main.c        Sun Jan 15 21:16:15 2006
+++ mutt-1.5.11/curs_main.c     Sun Jan 15 21:16:18 2006
@@ -615,6 +615,15 @@
        continue; /* either user abort or timeout */
       
       mutt_curs_set (1);
+
+      if (op == OP_USE_TAGFLAG)
+      {
+        if (option(OPTTAGFLAG))
+          op = OP_TAG_PREFIX;
+        else
+          op = km_dokey (MENU_MAIN);
+      }
+
       
       /* special handling for the tag-prefix function */
       if (op == OP_TAG_PREFIX)
@@ -2175,6 +2184,13 @@
          Context->changed = 1;
        menu->redraw = REDRAW_FULL;
        break;
+
+      case OP_SET_TAGFLAG:
+        if (tag)
+          set_option(OPTTAGFLAG);
+        else
+          unset_option(OPTTAGFLAG);
+        break;
 
       case OP_END_COND:
        break;
diff -r -u mutt-1.5.11.orig/functions.h mutt-1.5.11/functions.h
--- mutt-1.5.11.orig/functions.h        Sun Jan 15 21:16:15 2006
+++ mutt-1.5.11/functions.h     Sun Jan 15 21:16:18 2006
@@ -53,6 +53,8 @@
   { "tag-prefix",      OP_TAG_PREFIX,          ";" },
   { "tag-prefix-cond", OP_TAG_PREFIX_COND,     NULL },
   { "end-cond",                OP_END_COND,            NULL },
+  { "tag-set-tagflag", OP_SET_TAGFLAG,         NULL },
+  { "tag-use-tagflag", OP_USE_TAGFLAG,         NULL },
   { "shell-escape",    OP_SHELL_ESCAPE,        "!" },
   { "select-entry",    OP_GENERIC_SELECT_ENTRY,M_ENTER_S },
   { "search",          OP_SEARCH,              "/" },
diff -r -u mutt-1.5.11.orig/menu.c mutt-1.5.11/menu.c
--- mutt-1.5.11.orig/menu.c     Sun Jan 15 21:16:15 2006
+++ mutt-1.5.11/menu.c  Sun Jan 15 21:16:18 2006
@@ -877,6 +877,15 @@
       return i;
                    
     i = km_dokey (menu->menu);
+
+    if (i == OP_USE_TAGFLAG)
+    {
+      if (option(OPTTAGFLAG))
+        i = OP_TAG_PREFIX;
+      else
+        i = km_dokey (menu->menu);
+    }
+
     if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND)
     {
       if (menu->tagged)
@@ -1064,6 +1073,13 @@
 
       case OP_NULL:
        km_error_key (menu->menu);
+       break;
+
+      case OP_SET_TAGFLAG:
+        if (menu->tagprefix)
+          set_option(OPTTAGFLAG);
+        else
+          unset_option(OPTTAGFLAG);
        break;
 
       case OP_END_COND:
diff -r -u mutt-1.5.11.orig/mutt.h mutt-1.5.11/mutt.h
--- mutt-1.5.11.orig/mutt.h     Sun Jan 15 21:16:15 2006
+++ mutt-1.5.11/mutt.h  Sun Jan 15 21:16:18 2006
@@ -339,6 +339,7 @@
   OPTATTACHSPLIT,
   OPTAUTOEDIT,
   OPTAUTOTAG,
+  OPTTAGFLAG,
   OPTBEEP,
   OPTBEEPNEW,
   OPTBOUNCEDELIVERED,