[Top] [All Lists]

imapflags and variables

2003-05-10 20:16:05

short recap: imapflags consists of five actions

  ADDFLAG <flags: string-list>
  REMOVEFLAG <flags: string-list>
  SETFLAG <flags: string-list>

and a number of tagged arguments for KEEP and FILEINTO

  :flags <flags: string-list>
  :globalflags_plus <flags: string-list>
  :globalflags_minus <flags: string-list>

without one of the tagged arguments, no flags will be set.

there are two things some people desire:

  a) being able to restore an old set of flags
  b) get rid of some of the tagged argument variants

Marc suggests a system variable for accessing the current value,
${#imapflags}.  you can get rid of ':globalflags_plus "Flag"' like

        keep :flags "${#imapflags} Flag";

and ':globalflags_minus "Flag"' like this:

        set "safe_copy" "${#imapflags}";
        removeflag "Flag";
        keep :globalflags
        setflag "${safe_copy}";

the downside to this proposal is that it introduces a new syntax for
system variables since we don't want to allow assignment to them.
I'll also note that the first snippet will misbehave with no
diagnostics if the user has forgotten 'require "variables"'.

my suggestion is to add a another action instead, only available when
the variables extension is in effect:

        STOREFLAGS <variable: string>

the result of this is that the variable contains the list of flags
currently set.  the code to replace ':globalflags_plus "Flag"' becomes
a little more verbose:

        storeflags "curr_flags";
        keep :flags "${curr_flags} Flag";

the code for ':globalflag_minus "Flag"' is essentially the same.

        storeflags "safe_copy";
        removeflag "Flag";
        keep :globalflags
        setflag "${safe_copy}";

for both proposals, :globalflags is sufficient, but verbosity is
slightly increased without :flags <flag-list>.  more radically, we
could remove both and make :globalflags the default and mandatory
behaviour for KEEP/FILEINTO.  this way the implicit keep can set flags
on the message.  I think that would be useful.

Kjetil T.

<Prev in Thread] Current Thread [Next in Thread>