virtual sidebar tree with notmuch queries (follows #72) #202

Closed
opened 2022-11-15 20:01:31 +02:00 by blob42 · 2 comments

I would like display notmuch queries as a sidebar tree structure like with maildir.

One naive algorithm is to add an optionalparent key on each query definition that can be used to organize the virtual folders into a hierarchy.

I am willing to make a a PR myself for this feautre and was wondering if you already thought about this idea or if there's something I should think about ?

I would like display notmuch queries as a sidebar tree structure like with maildir. One naive algorithm is to add an optional`parent` key on each query definition that can be used to organize the virtual folders into a hierarchy. I am willing to make a a PR myself for this feautre and was wondering if you already thought about this idea or if there's something I should think about ?

Yes that should be possible!

The parent field of NotmuchMailbox is initialized to None in melib/src/backends/notmuch.rs:379. You can see above that how the query option is read from the config hashmap; a parent option key could be parsed if it exists.

There's some extra logic to be implemented to allow for a hierarchical mailbox tree:

  • path field of NotmuchMailbox should return the entire hierarchy instead of just the name as it is right now
  • circular paths must be detected and rejected (with a simple DFS)
  • Since you cannot know the children of a mailbox when you first create it because you haven't gone through all mailboxes in the config hashmap yet, an extra for loop should be added after inserting all mailboxes to populate the children field where appropriate.
  • in validate_config, the parent keys should be removed from the extra field since backends "consume" their special options when validating a config so that only unrecognized options remain in the hashmaps.

Finally, the new parent key should be added in meli.conf.5 manpage source, probably in the sample config too and whereever else notmuch is mentioned.

Yes that should be possible! The `parent` field of `NotmuchMailbox` is initialized to `None` in `melib/src/backends/notmuch.rs:379`. You can see above that how the `query` option is read from the config hashmap; a `parent` option key could be parsed if it exists. There's some extra logic to be implemented to allow for a hierarchical mailbox tree: - `path` field of `NotmuchMailbox` should return the entire hierarchy instead of just the name as it is right now - circular paths must be detected and rejected (with a simple DFS) - Since you cannot know the children of a mailbox when you first create it because you haven't gone through all mailboxes in the config hashmap yet, an extra for loop should be added after `insert`ing all mailboxes to populate the `children` field where appropriate. - in `validate_config`, the `parent` keys should be removed from the `extra` field since backends "consume" their special options when validating a config so that only unrecognized options remain in the hashmaps. Finally, the new `parent` key should be added in `meli.conf.5` manpage source, probably in the sample config too and whereever else notmuch is mentioned.
Manos Pitsidianakis added the
notmuch
enhancement
labels 2022-11-15 21:43:29 +02:00

Implemented in #170

Implemented in #170
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: meli/meli#202
There is no content yet.