Re: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)
On Sun, Dec 5, 2021 at 2:41 PM David Bremner wrote: > This should be fixed in 0.34.1-37-gc0115288, to be part of 0.35 > > There are one or two remaining corner cases involving escaped spaces and > tabs, but that goes above and beyond this request. Thanks! I'll test it once the new version hits the OpenSUSE rolling release repositories. Ciprian. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)
Ciprian Dorin Craciun writes: > > Given that the `~/.notmuch-config` resembles an INI file, and given > how lax the actual syntax is in general, I would suggest the > following: > > * allow white-spaces around `[ section ]`, and `field = value`; > * strip white-spaces (left and right) from values like `tags = unread > ; inbox ;`; (but not infix like `tag = some tag ; some other tag;`;) > * allow skipping the last `;` separator from `tags` and similar; > > Failing that, perhaps add a warning when parsing the configuration file. > This should be fixed in 0.34.1-37-gc0115288, to be part of 0.35 There are one or two remaining corner cases involving escaped spaces and tabs, but that goes above and beyond this request. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)
Ciprian Dorin Craciun writes: > > Given that the `~/.notmuch-config` resembles an INI file, and given > how lax the actual syntax is in general, I would suggest the > following: > > * allow white-spaces around `[ section ]`, and `field = value`; This is somewhat out of our control, as we rely on glib to parse these files. > * strip white-spaces (left and right) from values like `tags = unread > ; inbox ;`; (but not infix like `tag = some tag ; some other tag;`;) I will shortly send a patch to implement this. It has the potential issue that it is no longer possible to enter tags with leading/trailing spaces in the config file. That doesn't seem like a big deal to me, but I guess we'll see. > * allow skipping the last `;` separator from `tags` and similar; > This should be working now. The last ; is optional (since notmuch 0.32, I think). > Failing that, perhaps add a warning when parsing the configuration file. This again comes down to the config file parser we are using. However, we can (and do) scan the tags afterwards for certain issues, which we could further extend. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)
Ciprian Dorin Craciun writes: > > I've tried to manually edit my `~/.notmuch-config`, and I've seen that > the field `tags` was written as `tags=unread;inbox;`. In order to > increase readability I've decided to update my configuration file by > adding spaces around `=` and `;` as in `tags = unread ; inbox ;`. > Everything worked without a warning, until it didn't... :) > > What happened: all my emails are now tagged with `unread ` and ` > inbox `; (i.e. whitespace in tags). > Digging into the code a bit, the culprit seems to be _config_get_list. It is a bit surprising that the glib function g_key_file_get_string_list isn't a bit friendlier here (or at least better documented), but I guess the output of it needs to be postprocessed. d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Strip spaces in `tags` in `~/.notmuch-config` (and other fields)
[Sorry if I'm double reporting this. I've tried my best to search for previous discussions.] I've tried to manually edit my `~/.notmuch-config`, and I've seen that the field `tags` was written as `tags=unread;inbox;`. In order to increase readability I've decided to update my configuration file by adding spaces around `=` and `;` as in `tags = unread ; inbox ;`. Everything worked without a warning, until it didn't... :) What happened: all my emails are now tagged with `unread ` and ` inbox `; (i.e. whitespace in tags). Given that the `~/.notmuch-config` resembles an INI file, and given how lax the actual syntax is in general, I would suggest the following: * allow white-spaces around `[ section ]`, and `field = value`; * strip white-spaces (left and right) from values like `tags = unread ; inbox ;`; (but not infix like `tag = some tag ; some other tag;`;) * allow skipping the last `;` separator from `tags` and similar; Failing that, perhaps add a warning when parsing the configuration file. Hope it helps, Ciprian. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch