Contextes

12 views
Skip to first unread message

Yuri D'Elia

unread,
Feb 15, 2016, 5:53:51 PM2/15/16
to mu-di...@googlegroups.com
Some ideas here, don't take them too seriously.

Contextes help a lot in working with multiple accounts, however when
working with queries they somehow feel "short".

For instance, I'm looking at something, hit reply, but it's using the
wrong context:

https://github.com/djcb/mu/issues/799

I'm all for #776 (almost too magical), but what exactly is missing in
the message-send hook that wouldn't allow us to capture the context at
the last moment?

But scrap bothat, the issue is not really that I want to change identity
mid-flight, it's just that I had it wrong in the beginning.

Another thing I noticed are marks. Obviously, doing anything that
involves dynamic folders gets influenced by the current context.

After giving up all state, there's somehow this notion of "current id"
that feels out of place.

What if we put hidden properties in each line of the header view,
containing _very_ basic metadata such as from/to/list/maildir. Then,
when we act on the line (through marks or compose), we could try to call
a :match-hdr-func providing a more limited set of parameters.

My bet is that this would make the concept of "current context" almost
invisible, being merely a default for compose.

For example, I'd see myself using 'ask-if-none as the default compose
policy with the above method. I'd rather have the prompt only with a
numeric argument.

Dirk-Jan C. Binnema

unread,
Feb 16, 2016, 1:03:43 AM2/16/16
to mu-di...@googlegroups.com

On Tuesday Feb 16 2016, Yuri D'Elia wrote:

> Some ideas here, don't take them too seriously.
>
> Contextes help a lot in working with multiple accounts, however when
> working with queries they somehow feel "short".
>
> For instance, I'm looking at something, hit reply, but it's using the
> wrong context:
>
> https://github.com/djcb/mu/issues/799
>
> I'm all for #776 (almost too magical), but what exactly is missing in
> the message-send hook that wouldn't allow us to capture the context at
> the last moment?

I think #776 is magical enough :-) You can in fact implement all of that
using just using the current contexts and a few message-replace-header
etc. in your :enter-func. #776 is just about making that slightly more
convenient.

Practically, we need the message object, which we only have for the
_parent_ message, not the message that's about to be sent. The _parent_
message it what determines the context.

> But scrap bothat, the issue is not really that I want to change identity
> mid-flight, it's just that I had it wrong in the beginning.
>
> Another thing I noticed are marks. Obviously, doing anything that
> involves dynamic folders gets influenced by the current context.
>
> After giving up all state, there's somehow this notion of "current id"
> that feels out of place.
>
> What if we put hidden properties in each line of the header view,
> containing _very_ basic metadata such as from/to/list/maildir. Then,
> when we act on the line (through marks or compose), we could try to call
> a :match-hdr-func providing a more limited set of parameters.

That's what we're currently doing. See "(mu4e) Contexts and special
folders" in the manual.

Kind regards,
Dirk.


--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Yuri D'Elia

unread,
Feb 16, 2016, 6:31:00 AM2/16/16
to mu-di...@googlegroups.com
On Tue, Feb 16 2016, Dirk-Jan C. Binnema <dj...@djcbsoftware.nl> wrote:
> Practically, we need the message object, which we only have for the
> _parent_ message, not the message that's about to be sent. The _parent_
> message it what determines the context.

I see what you mean, also understanding a bit better what's it's done in
the header view.

>> What if we put hidden properties in each line of the header view,
>> containing _very_ basic metadata such as from/to/list/maildir. Then,
>> when we act on the line (through marks or compose), we could try to call
>> a :match-hdr-func providing a more limited set of parameters.
>
> That's what we're currently doing. See "(mu4e) Contexts and special
> folders" in the manual.

Oh.. that wasn't completely clear before, indeed.
Now it also explains why my :match-func didn't work as expected.

Since I was only matching on contact fields, I was deleting stuff not
directly addressed to me. I now match additionally on (mu4-message-field
msg :maildir) and it works perfectly.

Yuri D'Elia

unread,
Feb 18, 2016, 7:06:35 AM2/18/16
to mu-di...@googlegroups.com
On Tue, Feb 16 2016, Yuri D'Elia <wav...@thregr.org> wrote:
> On Tue, Feb 16 2016, Dirk-Jan C. Binnema <dj...@djcbsoftware.nl> wrote:
>>> What if we put hidden properties in each line of the header view,
>>> containing _very_ basic metadata such as from/to/list/maildir. Then,
>>> when we act on the line (through marks or compose), we could try to call
>>> a :match-hdr-func providing a more limited set of parameters.
>>
>> That's what we're currently doing. See "(mu4e) Contexts and special
>> folders" in the manual.
>
> Oh.. that wasn't completely clear before, indeed.
> Now it also explains why my :match-func didn't work as expected.

As an additional question I have.. when exactly :match-func can have a
nil argument?

If I have to check for it in all functions, wouldn't it make sense to
avoid the call in the first place?

Dirk-Jan C. Binnema

unread,
Feb 18, 2016, 1:11:41 PM2/18/16
to mu-di...@googlegroups.com
See: (info "(mu4e) What are contexts")
Reply all
Reply to author
Forward
0 new messages