Strip spaces in `tags` in `~/.notmuch-config` (and other fields)

Subject: Strip spaces in `tags` in `~/.notmuch-config` (and other fields)

Date: Fri, 24 Apr 2020 13:36:58 +0300

To: notmuch@notmuchmail.org

Cc:

From: Ciprian Dorin Craciun


[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

Thread: