[WIP PATCH 4/4] lib: Add "lastmod:" queries for filtering by last modification
Austin Clements writes: > From: Austin Clements > > XXX Includes reference to notmuch search --db-revision, which doesn't > exist. What would --db-revision do if it was implimented? Did you want to pass a UUID in? d
[WIP PATCH 4/4] lib: Add "lastmod:" queries for filtering by last modification
Quoth David Bremner on Jan 15 at 10:08 pm: > Austin Clements writes: > > > From: Austin Clements > > > > XXX Includes reference to notmuch search --db-revision, which doesn't > > exist. > > What would --db-revision do if it was implimented? Did you want to pass > a UUID in? Yes, exactly. And have the CLI abort if the UUID didn't match (meaning the lastmod values are no longer in the same sequence). > d
Images being displayed inline depending on the window size
On Tue, 30 Dec 2014, Sebastian Fischmeister wrote: > Hi, > > I have an email with 8 pictures attached. When I open the email > (notmuch-search-show-thread), some of them are opened and shown inline, > others are not. > > It seems that notmuch only shows the ones that fit on the screen > depending on how much space emacs has. E.g., the ones with a size of > 800x600 are usually displayed in full-screen mode but not the ones with > 600x800. > > Is there a way to control this behaviour? Please have a look at the mime-display customization group, perhaps the mm-inline-large-images variable. BR, Jani.
[PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
Austin, would you mind having a look at this one please? Thanks, Jani. On Wed, 14 Jan 2015, Todd wrote: > --- > lib/database-private.h | 15 --- > lib/database.cc| 10 -- > 2 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/lib/database-private.h b/lib/database-private.h > index 15e03cc..6d6fa2c 100644 > --- a/lib/database-private.h > +++ b/lib/database-private.h > @@ -92,6 +92,14 @@ enum _notmuch_features { > * > * Introduced: version 3. */ > NOTMUCH_FEATURE_GHOSTS = 1 << 4, > + > + > +/* If set, then the database was created after the introduction of > + * indexed mime types. If unset, then the database may contain a > + * mixture of messages with indexed and non-indexed mime types. > + * > + * Introduced: version 3. */ > +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, > }; > > /* In C++, a named enum is its own type, so define bitwise operators > @@ -161,9 +169,10 @@ struct _notmuch_database { > > /* Current database features. If any of these are missing from a > * database, request an upgrade. > - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because > - * upgrade doesn't currently introduce the feature (though brand new > - * databases will have it). */ > + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and > + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because upgrade > + * doesn't currently introduce the features (though brand new databases > + * will have it). */ > #define NOTMUCH_FEATURES_CURRENT \ > (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ > NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) > diff --git a/lib/database.cc b/lib/database.cc > index 3601f9d..2de60f8 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -304,6 +304,11 @@ static const struct { >"exact folder:/path: search", "rw" }, > { NOTMUCH_FEATURE_GHOSTS, >"mail documents for missing messages", "w"}, > +/* Knowledge of the index mime-types are not required for reading > + * a database because a reader will just be unable to query > + * them. */ > +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, > + "mime-types in database", "w"}, > }; > > const char * > @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, > notmuch_database_t **database) > if (status) > goto DONE; > > -/* Upgrade doesn't add this feature to existing databases, but new > - * databases have it. */ > +/* Upgrade doesn't add these feature to existing databases, but > + * new databases have them. */ > notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; > +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; > > status = notmuch_database_upgrade (notmuch, NULL, NULL); > if (status) { > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 1/5] Add a failing unit test for indexed mime types
On Thu, 15 Jan 2015, Jani Nikula wrote: > On Wed, 14 Jan 2015, Todd wrote: >> --- >> test/T190-multipart.sh | 32 >> 1 file changed, 32 insertions(+) >> >> diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh >> index 85cbf67..26f7c7a 100755 >> --- a/test/T190-multipart.sh >> +++ b/test/T190-multipart.sh >> @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 >> 7w0K >> --==-=-=-- >> EOF >> + >> +cat < content_types >> +From: Todd >> +To: todd at example.com >> +Subject: odd content types >> +Date: Mon, 12 Jan 2014 18:12:32 + >> +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 >> (i486-pc-linux-gnu) >> +Message-ID: >> +MIME-Version: 1.0 >> +Content-Type: multipart/alternative; boundary="==-=-==" >> + >> +--==-=-== >> +Content-Type: application/unique_identifier >> + >> +This is an embedded message, with a multipart/alternative part. >> + >> +--==-=-== >> +Content-Type: text/some_other_identifier >> + >> +This is an embedded message, with a multipart/alternative part. >> + >> +--==-=-==-- >> +EOF >> +cat content_types >> ${MAIL_DIR}/odd_content_type >> notmuch new > /dev/null >> >> test_begin_subtest "--format=text --part=0, full message" >> @@ -727,4 +751,12 @@ test_begin_subtest "html parts included" >> notmuch show --format=json --include-html id:htmlmessage > OUTPUT >> test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" >> >> +test_begin_subtest "indexes mime-type" > > test_subtest_known_broken > >> +output=$(notmuch search mimetype:application/unique_identifier | >> notmuch_search_sanitize) >> +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd >> content types (inbox unread)" >> + > > test_begin_subtest "indexes mime-type #2" > test_subtest_known_broken > > Then you'd remove test_subtest_known_broken when you add the feature. > >> +output=$(notmuch search mimetype:text/some_other_identifier | >> notmuch_search_sanitize) >> +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd >> content types (inbox unread)" > > I think I'd like to see a subtest for searching > mimetype:multipart/alternative (which should *not* find the message, > IIUC). Looking at the code in patch 3, I think it will index that. Please add the test so we know. ;) > > BR, > Jani. > >> + >> + >> test_done >> -- >> 1.9.1 >> >> ___ >> notmuch mailing list >> notmuch at notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 4/5] Update completions for Emacs and bash
On Wed, 14 Jan 2015, Todd wrote: > This adds completions for Emacs and bash, ZSH does not appear to have > completions for search terms. > --- > completion/notmuch-completion.bash | 2 +- > emacs/notmuch.el | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/completion/notmuch-completion.bash > b/completion/notmuch-completion.bash > index d58dc8b..05b5969 100644 > --- a/completion/notmuch-completion.bash > +++ b/completion/notmuch-completion.bash > @@ -61,7 +61,7 @@ _notmuch_search_terms() > sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) ) > ;; > *) > - local search_terms="from: to: subject: attachment: tag: id: thread: > folder: path: date:" > + local search_terms="from: to: subject: attachment: contenttype: > tag: id: thread: folder: path: date:" Should be mimetype. BR, Jani. > compopt -o nospace > COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) ) > ;; > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > index 218486a..ab00454 100644 > --- a/emacs/notmuch.el > +++ b/emacs/notmuch.el > @@ -858,7 +858,7 @@ PROMPT is the string to prompt with." >(lexical-let >((completions > (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" > - "subject:" "attachment:") > + "subject:" "attachment:" "mimetype:") > (mapcar (lambda (tag) > (concat "tag:" (notmuch-escape-boolean-term tag))) > (process-lines notmuch-command "search" "--output=tags" > "*") > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 3/5] Add indexing for the mimetype term
Please add a commit message. On Wed, 14 Jan 2015, Todd wrote: > --- > lib/database.cc | 1 + > lib/index.cc| 6 ++ > 2 files changed, 7 insertions(+) > > diff --git a/lib/database.cc b/lib/database.cc > index 2de60f8..7c7a267 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= { > { "from","XFROM" }, > { "to", "XTO" }, > { "attachment", "XATTACHMENT" }, > +{ "mimetype","XMIMETYPE"}, > { "subject", "XSUBJECT"}, > }; > > diff --git a/lib/index.cc b/lib/index.cc > index 1a2e63d..2e27558 100644 > --- a/lib/index.cc > +++ b/lib/index.cc > @@ -318,6 +318,12 @@ _index_mime_part (notmuch_message_t *message, > return; > } > > + Superfluous newline. > +GMimeContentType* content_type = g_mime_object_get_content_type(part); Please replace "* " with " *". > +if (content_type) { > + _notmuch_message_gen_terms (message, "mimetype", > g_mime_content_type_to_string(content_type)); > +} Check g_mime_content_type_to_string return value, and g_free the result afterwards. BR, Jani. > + > if (GMIME_IS_MULTIPART (part)) { > GMimeMultipart *multipart = GMIME_MULTIPART (part); > int i; > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 1/5] Add a failing unit test for indexed mime types
On Wed, 14 Jan 2015, Todd wrote: > --- > test/T190-multipart.sh | 32 > 1 file changed, 32 insertions(+) > > diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh > index 85cbf67..26f7c7a 100755 > --- a/test/T190-multipart.sh > +++ b/test/T190-multipart.sh > @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 > 7w0K > --==-=-=-- > EOF > + > +cat < content_types > +From: Todd > +To: todd at example.com > +Subject: odd content types > +Date: Mon, 12 Jan 2014 18:12:32 + > +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 > (i486-pc-linux-gnu) > +Message-ID: > +MIME-Version: 1.0 > +Content-Type: multipart/alternative; boundary="==-=-==" > + > +--==-=-== > +Content-Type: application/unique_identifier > + > +This is an embedded message, with a multipart/alternative part. > + > +--==-=-== > +Content-Type: text/some_other_identifier > + > +This is an embedded message, with a multipart/alternative part. > + > +--==-=-==-- > +EOF > +cat content_types >> ${MAIL_DIR}/odd_content_type > notmuch new > /dev/null > > test_begin_subtest "--format=text --part=0, full message" > @@ -727,4 +751,12 @@ test_begin_subtest "html parts included" > notmuch show --format=json --include-html id:htmlmessage > OUTPUT > test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" > > +test_begin_subtest "indexes mime-type" test_subtest_known_broken > +output=$(notmuch search mimetype:application/unique_identifier | > notmuch_search_sanitize) > +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content > types (inbox unread)" > + test_begin_subtest "indexes mime-type #2" test_subtest_known_broken Then you'd remove test_subtest_known_broken when you add the feature. > +output=$(notmuch search mimetype:text/some_other_identifier | > notmuch_search_sanitize) > +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content > types (inbox unread)" I think I'd like to see a subtest for searching mimetype:multipart/alternative (which should *not* find the message, IIUC). BR, Jani. > + > + > test_done > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 5/5] Update documentation
--- NEWS | 11 +++ doc/man7/notmuch-search-terms.rst | 6 ++ 2 files changed, 17 insertions(+) diff --git a/NEWS b/NEWS index abb5ad7..baa4519 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ Notmuch 0.20 (UNRELEASED) += Contrib --- @@ -7,6 +8,16 @@ Contrib previously provided by `notmuch-deliver` should now be provided by `notmuch insert`, provided by the main notmuch binary. +Command-Line Interface +-- + +There is a new `mimetype:` search prefix + + The new `mimetype:` search prefix allows searching for the + content-type of attachments, which is now indexed by `notmuch + insert`. See the `notmuch-search-terms` manual page for details. + + Notmuch 0.19 (2014-11-14) = diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst index 1acdaa0..8d1acfc 100644 --- a/doc/man7/notmuch-search-terms.rst +++ b/doc/man7/notmuch-search-terms.rst @@ -40,6 +40,8 @@ indicate user-supplied values): - attachment: +- mimetype: + - tag: (or is:) - id: @@ -66,6 +68,10 @@ by including quotation marks around the phrase, immediately following The **attachment:** prefix can be used to search for specific filenames (or extensions) of attachments to email messages. +The **mimetype:** prefix can be used to search for the specific +content-types of mime parts within email messages (as specified by the +sender). + For **tag:** and **is:** valid tag values include **inbox** and **unread** by default for new messages added by **notmuch new** as well as any other tag values added manually with **notmuch tag**. -- 1.9.1
[PATCH v3 4/5] Update completions for Emacs and bash
This adds completions for Emacs and bash, ZSH does not appear to have completions for search terms. --- completion/notmuch-completion.bash | 2 +- emacs/notmuch.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index d58dc8b..39320f8 100644 --- a/completion/notmuch-completion.bash +++ b/completion/notmuch-completion.bash @@ -61,7 +61,7 @@ _notmuch_search_terms() sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) ) ;; *) - local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:" + local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date:" compopt -o nospace COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) ) ;; diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 218486a..ab00454 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -858,7 +858,7 @@ PROMPT is the string to prompt with." (lexical-let ((completions (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" - "subject:" "attachment:") + "subject:" "attachment:" "mimetype:") (mapcar (lambda (tag) (concat "tag:" (notmuch-escape-boolean-term tag))) (process-lines notmuch-command "search" "--output=tags" "*") -- 1.9.1
[PATCH v3 3/5] Add indexing for the mimetype term
Adds the indexing and removes the broken test flag --- lib/database.cc| 1 + lib/index.cc | 10 ++ test/T190-multipart.sh | 4 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 0d2c417..3974e2e 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= { { "from", "XFROM" }, { "to","XTO" }, { "attachment","XATTACHMENT" }, +{ "mimetype", "XMIMETYPE"}, { "subject", "XSUBJECT"}, }; diff --git a/lib/index.cc b/lib/index.cc index 1a2e63d..c88ed8d 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -318,6 +318,16 @@ _index_mime_part (notmuch_message_t *message, return; } +GMimeContentType *content_type = g_mime_object_get_content_type(part); +if (content_type) { + char *mime_string = g_mime_content_type_to_string(content_type); + if (mime_string) + { + _notmuch_message_gen_terms (message, "mimetype", mime_string); + g_free(mime_string); + } +} + if (GMIME_IS_MULTIPART (part)) { GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh index 57f1b61..de7d361 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -752,22 +752,18 @@ notmuch show --format=json --include-html id:htmlmessage > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" test_begin_subtest "indexes mime-type #1" -test_subtest_known_broken output=$(notmuch search mimetype:application/unique_identifier | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "indexes mime-type #2" -test_subtest_known_broken output=$(notmuch search mimetype:text/some_other_identifier | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "indexes mime-type #3" -test_subtest_known_broken output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "search for non-existent mime-type" -test_subtest_known_broken output=$(notmuch search mimetype:non-existent/mime-type | notmuch_search_sanitize) test_expect_equal "$output" "" -- 1.9.1
[PATCH v3 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
--- lib/database-private.h | 15 --- lib/database.cc| 10 -- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index 15e03cc..6d6fa2c 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -92,6 +92,14 @@ enum _notmuch_features { * * Introduced: version 3. */ NOTMUCH_FEATURE_GHOSTS = 1 << 4, + + +/* If set, then the database was created after the introduction of + * indexed mime types. If unset, then the database may contain a + * mixture of messages with indexed and non-indexed mime types. + * + * Introduced: version 3. */ +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, }; /* In C++, a named enum is its own type, so define bitwise operators @@ -161,9 +169,10 @@ struct _notmuch_database { /* Current database features. If any of these are missing from a * database, request an upgrade. - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because - * upgrade doesn't currently introduce the feature (though brand new - * databases will have it). */ + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because upgrade + * doesn't currently introduce the features (though brand new databases + * will have it). */ #define NOTMUCH_FEATURES_CURRENT \ (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) diff --git a/lib/database.cc b/lib/database.cc index 3601f9d..0d2c417 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -304,6 +304,11 @@ static const struct { "exact folder:/path: search", "rw" }, { NOTMUCH_FEATURE_GHOSTS, "mail documents for missing messages", "w"}, +/* Knowledge of the index mime-types are not required for reading + * a database because a reader will just be unable to query + * them. */ +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, + "indexed MIME types", "w"}, }; const char * @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, notmuch_database_t **database) if (status) goto DONE; -/* Upgrade doesn't add this feature to existing databases, but new - * databases have it. */ +/* Upgrade doesn't add these feature to existing databases, but + * new databases have them. */ notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; status = notmuch_database_upgrade (notmuch, NULL, NULL); if (status) { -- 1.9.1
[PATCH v3 1/5] Add failing unit tests for indexed mime types
--- test/T190-multipart.sh | 44 1 file changed, 44 insertions(+) diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh index 85cbf67..57f1b61 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 7w0K --==-=-=-- EOF + +cat < content_types +From: Todd +To: todd at example.com +Subject: odd content types +Date: Mon, 12 Jan 2014 18:12:32 + +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="==-=-==" + +--==-=-== +Content-Type: application/unique_identifier + +This is an embedded message, with a multipart/alternative part. + +--==-=-== +Content-Type: text/some_other_identifier + +This is an embedded message, with a multipart/alternative part. + +--==-=-==-- +EOF +cat content_types >> ${MAIL_DIR}/odd_content_type notmuch new > /dev/null test_begin_subtest "--format=text --part=0, full message" @@ -727,4 +751,24 @@ test_begin_subtest "html parts included" notmuch show --format=json --include-html id:htmlmessage > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" +test_begin_subtest "indexes mime-type #1" +test_subtest_known_broken +output=$(notmuch search mimetype:application/unique_identifier | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "indexes mime-type #2" +test_subtest_known_broken +output=$(notmuch search mimetype:text/some_other_identifier | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "indexes mime-type #3" +test_subtest_known_broken +output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "search for non-existent mime-type" +test_subtest_known_broken +output=$(notmuch search mimetype:non-existent/mime-type | notmuch_search_sanitize) +test_expect_equal "$output" "" + test_done -- 1.9.1
Re: [WIP PATCH 4/4] lib: Add "lastmod:" queries for filtering by last modification
Quoth David Bremner on Jan 15 at 10:08 pm: > Austin Clements writes: > > > From: Austin Clements > > > > XXX Includes reference to notmuch search --db-revision, which doesn't > > exist. > > What would --db-revision do if it was implimented? Did you want to pass > a UUID in? Yes, exactly. And have the CLI abort if the UUID didn't match (meaning the lastmod values are no longer in the same sequence). > d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
--- lib/database-private.h | 15 --- lib/database.cc| 10 -- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index 15e03cc..6d6fa2c 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -92,6 +92,14 @@ enum _notmuch_features { * * Introduced: version 3. */ NOTMUCH_FEATURE_GHOSTS = 1 << 4, + + +/* If set, then the database was created after the introduction of + * indexed mime types. If unset, then the database may contain a + * mixture of messages with indexed and non-indexed mime types. + * + * Introduced: version 3. */ +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, }; /* In C++, a named enum is its own type, so define bitwise operators @@ -161,9 +169,10 @@ struct _notmuch_database { /* Current database features. If any of these are missing from a * database, request an upgrade. - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because - * upgrade doesn't currently introduce the feature (though brand new - * databases will have it). */ + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because upgrade + * doesn't currently introduce the features (though brand new databases + * will have it). */ #define NOTMUCH_FEATURES_CURRENT \ (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) diff --git a/lib/database.cc b/lib/database.cc index 3601f9d..0d2c417 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -304,6 +304,11 @@ static const struct { "exact folder:/path: search", "rw" }, { NOTMUCH_FEATURE_GHOSTS, "mail documents for missing messages", "w"}, +/* Knowledge of the index mime-types are not required for reading + * a database because a reader will just be unable to query + * them. */ +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, + "indexed MIME types", "w"}, }; const char * @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, notmuch_database_t **database) if (status) goto DONE; -/* Upgrade doesn't add this feature to existing databases, but new - * databases have it. */ +/* Upgrade doesn't add these feature to existing databases, but + * new databases have them. */ notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; status = notmuch_database_upgrade (notmuch, NULL, NULL); if (status) { -- 1.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 4/5] Update completions for Emacs and bash
This adds completions for Emacs and bash, ZSH does not appear to have completions for search terms. --- completion/notmuch-completion.bash | 2 +- emacs/notmuch.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index d58dc8b..39320f8 100644 --- a/completion/notmuch-completion.bash +++ b/completion/notmuch-completion.bash @@ -61,7 +61,7 @@ _notmuch_search_terms() sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) ) ;; *) - local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:" + local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date:" compopt -o nospace COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) ) ;; diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 218486a..ab00454 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -858,7 +858,7 @@ PROMPT is the string to prompt with." (lexical-let ((completions (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" - "subject:" "attachment:") + "subject:" "attachment:" "mimetype:") (mapcar (lambda (tag) (concat "tag:" (notmuch-escape-boolean-term tag))) (process-lines notmuch-command "search" "--output=tags" "*") -- 1.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 5/5] Update documentation
--- NEWS | 11 +++ doc/man7/notmuch-search-terms.rst | 6 ++ 2 files changed, 17 insertions(+) diff --git a/NEWS b/NEWS index abb5ad7..baa4519 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ Notmuch 0.20 (UNRELEASED) += Contrib --- @@ -7,6 +8,16 @@ Contrib previously provided by `notmuch-deliver` should now be provided by `notmuch insert`, provided by the main notmuch binary. +Command-Line Interface +-- + +There is a new `mimetype:` search prefix + + The new `mimetype:` search prefix allows searching for the + content-type of attachments, which is now indexed by `notmuch + insert`. See the `notmuch-search-terms` manual page for details. + + Notmuch 0.19 (2014-11-14) = diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst index 1acdaa0..8d1acfc 100644 --- a/doc/man7/notmuch-search-terms.rst +++ b/doc/man7/notmuch-search-terms.rst @@ -40,6 +40,8 @@ indicate user-supplied values): - attachment: +- mimetype: + - tag: (or is:) - id: @@ -66,6 +68,10 @@ by including quotation marks around the phrase, immediately following The **attachment:** prefix can be used to search for specific filenames (or extensions) of attachments to email messages. +The **mimetype:** prefix can be used to search for the specific +content-types of mime parts within email messages (as specified by the +sender). + For **tag:** and **is:** valid tag values include **inbox** and **unread** by default for new messages added by **notmuch new** as well as any other tag values added manually with **notmuch tag**. -- 1.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 1/5] Add failing unit tests for indexed mime types
--- test/T190-multipart.sh | 44 1 file changed, 44 insertions(+) diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh index 85cbf67..57f1b61 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 7w0K --==-=-=-- EOF + +cat < content_types +From: Todd +To: t...@example.com +Subject: odd content types +Date: Mon, 12 Jan 2014 18:12:32 + +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="==-=-==" + +--==-=-== +Content-Type: application/unique_identifier + +This is an embedded message, with a multipart/alternative part. + +--==-=-== +Content-Type: text/some_other_identifier + +This is an embedded message, with a multipart/alternative part. + +--==-=-==-- +EOF +cat content_types >> ${MAIL_DIR}/odd_content_type notmuch new > /dev/null test_begin_subtest "--format=text --part=0, full message" @@ -727,4 +751,24 @@ test_begin_subtest "html parts included" notmuch show --format=json --include-html id:htmlmessage > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" +test_begin_subtest "indexes mime-type #1" +test_subtest_known_broken +output=$(notmuch search mimetype:application/unique_identifier | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "indexes mime-type #2" +test_subtest_known_broken +output=$(notmuch search mimetype:text/some_other_identifier | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "indexes mime-type #3" +test_subtest_known_broken +output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" + +test_begin_subtest "search for non-existent mime-type" +test_subtest_known_broken +output=$(notmuch search mimetype:non-existent/mime-type | notmuch_search_sanitize) +test_expect_equal "$output" "" + test_done -- 1.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3 3/5] Add indexing for the mimetype term
Adds the indexing and removes the broken test flag --- lib/database.cc| 1 + lib/index.cc | 10 ++ test/T190-multipart.sh | 4 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 0d2c417..3974e2e 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= { { "from", "XFROM" }, { "to","XTO" }, { "attachment","XATTACHMENT" }, +{ "mimetype", "XMIMETYPE"}, { "subject", "XSUBJECT"}, }; diff --git a/lib/index.cc b/lib/index.cc index 1a2e63d..c88ed8d 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -318,6 +318,16 @@ _index_mime_part (notmuch_message_t *message, return; } +GMimeContentType *content_type = g_mime_object_get_content_type(part); +if (content_type) { + char *mime_string = g_mime_content_type_to_string(content_type); + if (mime_string) + { + _notmuch_message_gen_terms (message, "mimetype", mime_string); + g_free(mime_string); + } +} + if (GMIME_IS_MULTIPART (part)) { GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh index 57f1b61..de7d361 100755 --- a/test/T190-multipart.sh +++ b/test/T190-multipart.sh @@ -752,22 +752,18 @@ notmuch show --format=json --include-html id:htmlmessage > OUTPUT test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" test_begin_subtest "indexes mime-type #1" -test_subtest_known_broken output=$(notmuch search mimetype:application/unique_identifier | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "indexes mime-type #2" -test_subtest_known_broken output=$(notmuch search mimetype:text/some_other_identifier | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "indexes mime-type #3" -test_subtest_known_broken output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_begin_subtest "search for non-existent mime-type" -test_subtest_known_broken output=$(notmuch search mimetype:non-existent/mime-type | notmuch_search_sanitize) test_expect_equal "$output" "" -- 1.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
proposal: remove support for gmime2.4
On Thu 2015-01-15 05:20:47 -0500, David Bremner wrote: > It seems no very recent system has gmime2.4. I guess several of these > gmime2.4 only code paths are both security critical (e.g. in crypto.c) > and mostly untested. > > Is there good reason to keep supporting gmime 2.4? gmime 2.6 is available in squeeze-backports, which is about as old as anyone can reasonably expect to run an end-user system these days in my book. I have no objection to dropping gmime 2.4 support. --dkg -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 948 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20150115/62b8265f/attachment.pgp>
proposal: remove support for gmime2.4
On Thu, Jan 15 2015, David Bremner wrote: > It seems no very recent system has gmime2.4. I guess several of these > gmime2.4 only code paths are both security critical (e.g. in crypto.c) > and mostly untested. > > Is there good reason to keep supporting gmime 2.4? if there are potential security issues that we do not test (i.e. I do not test), then removing (instead of just deprecating) is a good option -- I'll just have to install gmime-2.6 on my Scientific Linux 6.2 system... Tomi > > d
[PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
Just one nit. Otherwise this patch LGTM. On January 15, 2015 12:20:08 PM EST, Jani Nikula wrote: > >Austin, would you mind having a look at this one please? > >Thanks, >Jani. > >On Wed, 14 Jan 2015, Todd wrote: >> --- >> lib/database-private.h | 15 --- >> lib/database.cc| 10 -- >> 2 files changed, 20 insertions(+), 5 deletions(-) >> >> diff --git a/lib/database-private.h b/lib/database-private.h >> index 15e03cc..6d6fa2c 100644 >> --- a/lib/database-private.h >> +++ b/lib/database-private.h >> @@ -92,6 +92,14 @@ enum _notmuch_features { >> * >> * Introduced: version 3. */ >> NOTMUCH_FEATURE_GHOSTS = 1 << 4, >> + >> + >> +/* If set, then the database was created after the introduction >of >> + * indexed mime types. If unset, then the database may contain a >> + * mixture of messages with indexed and non-indexed mime types. >> + * >> + * Introduced: version 3. */ >> +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, >> }; >> >> /* In C++, a named enum is its own type, so define bitwise operators >> @@ -161,9 +169,10 @@ struct _notmuch_database { >> >> /* Current database features. If any of these are missing from a >> * database, request an upgrade. >> - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because >> - * upgrade doesn't currently introduce the feature (though brand new >> - * databases will have it). */ >> + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and >> + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because >upgrade >> + * doesn't currently introduce the features (though brand new >databases >> + * will have it). */ >> #define NOTMUCH_FEATURES_CURRENT \ >> (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ >> NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) >> diff --git a/lib/database.cc b/lib/database.cc >> index 3601f9d..2de60f8 100644 >> --- a/lib/database.cc >> +++ b/lib/database.cc >> @@ -304,6 +304,11 @@ static const struct { >>"exact folder:/path: search", "rw" }, >> { NOTMUCH_FEATURE_GHOSTS, >>"mail documents for missing messages", "w"}, >> +/* Knowledge of the index mime-types are not required for >reading >> + * a database because a reader will just be unable to query >> + * them. */ >> +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, >> + "mime-types in database", "w"}, I would label this "indexed MIME types" to be closer to the enum and because "MIME" is an acronym and hence should be capitalized. >> }; >> >> const char * >> @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, >notmuch_database_t **database) >> if (status) >> goto DONE; >> >> -/* Upgrade doesn't add this feature to existing databases, but >new >> - * databases have it. */ >> +/* Upgrade doesn't add these feature to existing databases, but >> + * new databases have them. */ >> notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; >> +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; >> >> status = notmuch_database_upgrade (notmuch, NULL, NULL); >> if (status) { >> -- >> 1.9.1 >> >> ___ >> notmuch mailing list >> notmuch at notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch
Re: [WIP PATCH 4/4] lib: Add "lastmod:" queries for filtering by last modification
Austin Clements writes: > From: Austin Clements > > XXX Includes reference to notmuch search --db-revision, which doesn't > exist. What would --db-revision do if it was implimented? Did you want to pass a UUID in? d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: proposal: remove support for gmime2.4
On Thu 2015-01-15 05:20:47 -0500, David Bremner wrote: > It seems no very recent system has gmime2.4. I guess several of these > gmime2.4 only code paths are both security critical (e.g. in crypto.c) > and mostly untested. > > Is there good reason to keep supporting gmime 2.4? gmime 2.6 is available in squeeze-backports, which is about as old as anyone can reasonably expect to run an end-user system these days in my book. I have no objection to dropping gmime 2.4 support. --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
proposal: remove support for gmime2.4
It seems no very recent system has gmime2.4. I guess several of these gmime2.4 only code paths are both security critical (e.g. in crypto.c) and mostly untested. Is there good reason to keep supporting gmime 2.4? d
Re: [PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
Just one nit. Otherwise this patch LGTM. On January 15, 2015 12:20:08 PM EST, Jani Nikula wrote: > >Austin, would you mind having a look at this one please? > >Thanks, >Jani. > >On Wed, 14 Jan 2015, Todd wrote: >> --- >> lib/database-private.h | 15 --- >> lib/database.cc| 10 -- >> 2 files changed, 20 insertions(+), 5 deletions(-) >> >> diff --git a/lib/database-private.h b/lib/database-private.h >> index 15e03cc..6d6fa2c 100644 >> --- a/lib/database-private.h >> +++ b/lib/database-private.h >> @@ -92,6 +92,14 @@ enum _notmuch_features { >> * >> * Introduced: version 3. */ >> NOTMUCH_FEATURE_GHOSTS = 1 << 4, >> + >> + >> +/* If set, then the database was created after the introduction >of >> + * indexed mime types. If unset, then the database may contain a >> + * mixture of messages with indexed and non-indexed mime types. >> + * >> + * Introduced: version 3. */ >> +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, >> }; >> >> /* In C++, a named enum is its own type, so define bitwise operators >> @@ -161,9 +169,10 @@ struct _notmuch_database { >> >> /* Current database features. If any of these are missing from a >> * database, request an upgrade. >> - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because >> - * upgrade doesn't currently introduce the feature (though brand new >> - * databases will have it). */ >> + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and >> + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because >upgrade >> + * doesn't currently introduce the features (though brand new >databases >> + * will have it). */ >> #define NOTMUCH_FEATURES_CURRENT \ >> (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ >> NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) >> diff --git a/lib/database.cc b/lib/database.cc >> index 3601f9d..2de60f8 100644 >> --- a/lib/database.cc >> +++ b/lib/database.cc >> @@ -304,6 +304,11 @@ static const struct { >>"exact folder:/path: search", "rw" }, >> { NOTMUCH_FEATURE_GHOSTS, >>"mail documents for missing messages", "w"}, >> +/* Knowledge of the index mime-types are not required for >reading >> + * a database because a reader will just be unable to query >> + * them. */ >> +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, >> + "mime-types in database", "w"}, I would label this "indexed MIME types" to be closer to the enum and because "MIME" is an acronym and hence should be capitalized. >> }; >> >> const char * >> @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, >notmuch_database_t **database) >> if (status) >> goto DONE; >> >> -/* Upgrade doesn't add this feature to existing databases, but >new >> - * databases have it. */ >> +/* Upgrade doesn't add these feature to existing databases, but >> + * new databases have them. */ >> notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; >> +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; >> >> status = notmuch_database_upgrade (notmuch, NULL, NULL); >> if (status) { >> -- >> 1.9.1 >> >> ___ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: Images being displayed inline depending on the window size
On Tue, 30 Dec 2014, Sebastian Fischmeister wrote: > Hi, > > I have an email with 8 pictures attached. When I open the email > (notmuch-search-show-thread), some of them are opened and shown inline, > others are not. > > It seems that notmuch only shows the ones that fit on the screen > depending on how much space emacs has. E.g., the ones with a size of > 800x600 are usually displayed in full-screen mode but not the ones with > 600x800. > > Is there a way to control this behaviour? Please have a look at the mime-display customization group, perhaps the mm-inline-large-images variable. BR, Jani. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
Austin, would you mind having a look at this one please? Thanks, Jani. On Wed, 14 Jan 2015, Todd wrote: > --- > lib/database-private.h | 15 --- > lib/database.cc| 10 -- > 2 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/lib/database-private.h b/lib/database-private.h > index 15e03cc..6d6fa2c 100644 > --- a/lib/database-private.h > +++ b/lib/database-private.h > @@ -92,6 +92,14 @@ enum _notmuch_features { > * > * Introduced: version 3. */ > NOTMUCH_FEATURE_GHOSTS = 1 << 4, > + > + > +/* If set, then the database was created after the introduction of > + * indexed mime types. If unset, then the database may contain a > + * mixture of messages with indexed and non-indexed mime types. > + * > + * Introduced: version 3. */ > +NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5, > }; > > /* In C++, a named enum is its own type, so define bitwise operators > @@ -161,9 +169,10 @@ struct _notmuch_database { > > /* Current database features. If any of these are missing from a > * database, request an upgrade. > - * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because > - * upgrade doesn't currently introduce the feature (though brand new > - * databases will have it). */ > + * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and > + * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because upgrade > + * doesn't currently introduce the features (though brand new databases > + * will have it). */ > #define NOTMUCH_FEATURES_CURRENT \ > (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \ > NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS) > diff --git a/lib/database.cc b/lib/database.cc > index 3601f9d..2de60f8 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -304,6 +304,11 @@ static const struct { >"exact folder:/path: search", "rw" }, > { NOTMUCH_FEATURE_GHOSTS, >"mail documents for missing messages", "w"}, > +/* Knowledge of the index mime-types are not required for reading > + * a database because a reader will just be unable to query > + * them. */ > +{ NOTMUCH_FEATURE_INDEXED_MIMETYPES, > + "mime-types in database", "w"}, > }; > > const char * > @@ -646,9 +651,10 @@ notmuch_database_create (const char *path, > notmuch_database_t **database) > if (status) > goto DONE; > > -/* Upgrade doesn't add this feature to existing databases, but new > - * databases have it. */ > +/* Upgrade doesn't add these feature to existing databases, but > + * new databases have them. */ > notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES; > +notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES; > > status = notmuch_database_upgrade (notmuch, NULL, NULL); > if (status) { > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 1/5] Add a failing unit test for indexed mime types
On Thu, 15 Jan 2015, Jani Nikula wrote: > On Wed, 14 Jan 2015, Todd wrote: >> --- >> test/T190-multipart.sh | 32 >> 1 file changed, 32 insertions(+) >> >> diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh >> index 85cbf67..26f7c7a 100755 >> --- a/test/T190-multipart.sh >> +++ b/test/T190-multipart.sh >> @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 >> 7w0K >> --==-=-=-- >> EOF >> + >> +cat < content_types >> +From: Todd >> +To: t...@example.com >> +Subject: odd content types >> +Date: Mon, 12 Jan 2014 18:12:32 + >> +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 >> (i486-pc-linux-gnu) >> +Message-ID: >> +MIME-Version: 1.0 >> +Content-Type: multipart/alternative; boundary="==-=-==" >> + >> +--==-=-== >> +Content-Type: application/unique_identifier >> + >> +This is an embedded message, with a multipart/alternative part. >> + >> +--==-=-== >> +Content-Type: text/some_other_identifier >> + >> +This is an embedded message, with a multipart/alternative part. >> + >> +--==-=-==-- >> +EOF >> +cat content_types >> ${MAIL_DIR}/odd_content_type >> notmuch new > /dev/null >> >> test_begin_subtest "--format=text --part=0, full message" >> @@ -727,4 +751,12 @@ test_begin_subtest "html parts included" >> notmuch show --format=json --include-html id:htmlmessage > OUTPUT >> test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" >> >> +test_begin_subtest "indexes mime-type" > > test_subtest_known_broken > >> +output=$(notmuch search mimetype:application/unique_identifier | >> notmuch_search_sanitize) >> +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd >> content types (inbox unread)" >> + > > test_begin_subtest "indexes mime-type #2" > test_subtest_known_broken > > Then you'd remove test_subtest_known_broken when you add the feature. > >> +output=$(notmuch search mimetype:text/some_other_identifier | >> notmuch_search_sanitize) >> +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd >> content types (inbox unread)" > > I think I'd like to see a subtest for searching > mimetype:multipart/alternative (which should *not* find the message, > IIUC). Looking at the code in patch 3, I think it will index that. Please add the test so we know. ;) > > BR, > Jani. > >> + >> + >> test_done >> -- >> 1.9.1 >> >> ___ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 4/5] Update completions for Emacs and bash
On Wed, 14 Jan 2015, Todd wrote: > This adds completions for Emacs and bash, ZSH does not appear to have > completions for search terms. > --- > completion/notmuch-completion.bash | 2 +- > emacs/notmuch.el | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/completion/notmuch-completion.bash > b/completion/notmuch-completion.bash > index d58dc8b..05b5969 100644 > --- a/completion/notmuch-completion.bash > +++ b/completion/notmuch-completion.bash > @@ -61,7 +61,7 @@ _notmuch_search_terms() > sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) ) > ;; > *) > - local search_terms="from: to: subject: attachment: tag: id: thread: > folder: path: date:" > + local search_terms="from: to: subject: attachment: contenttype: > tag: id: thread: folder: path: date:" Should be mimetype. BR, Jani. > compopt -o nospace > COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) ) > ;; > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > index 218486a..ab00454 100644 > --- a/emacs/notmuch.el > +++ b/emacs/notmuch.el > @@ -858,7 +858,7 @@ PROMPT is the string to prompt with." >(lexical-let >((completions > (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" > - "subject:" "attachment:") > + "subject:" "attachment:" "mimetype:") > (mapcar (lambda (tag) > (concat "tag:" (notmuch-escape-boolean-term tag))) > (process-lines notmuch-command "search" "--output=tags" > "*") > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 3/5] Add indexing for the mimetype term
Please add a commit message. On Wed, 14 Jan 2015, Todd wrote: > --- > lib/database.cc | 1 + > lib/index.cc| 6 ++ > 2 files changed, 7 insertions(+) > > diff --git a/lib/database.cc b/lib/database.cc > index 2de60f8..7c7a267 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= { > { "from","XFROM" }, > { "to", "XTO" }, > { "attachment", "XATTACHMENT" }, > +{ "mimetype","XMIMETYPE"}, > { "subject", "XSUBJECT"}, > }; > > diff --git a/lib/index.cc b/lib/index.cc > index 1a2e63d..2e27558 100644 > --- a/lib/index.cc > +++ b/lib/index.cc > @@ -318,6 +318,12 @@ _index_mime_part (notmuch_message_t *message, > return; > } > > + Superfluous newline. > +GMimeContentType* content_type = g_mime_object_get_content_type(part); Please replace "* " with " *". > +if (content_type) { > + _notmuch_message_gen_terms (message, "mimetype", > g_mime_content_type_to_string(content_type)); > +} Check g_mime_content_type_to_string return value, and g_free the result afterwards. BR, Jani. > + > if (GMIME_IS_MULTIPART (part)) { > GMimeMultipart *multipart = GMIME_MULTIPART (part); > int i; > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 1/5] Add a failing unit test for indexed mime types
On Wed, 14 Jan 2015, Todd wrote: > --- > test/T190-multipart.sh | 32 > 1 file changed, 32 insertions(+) > > diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh > index 85cbf67..26f7c7a 100755 > --- a/test/T190-multipart.sh > +++ b/test/T190-multipart.sh > @@ -104,6 +104,30 @@ Content-Transfer-Encoding: base64 > 7w0K > --==-=-=-- > EOF > + > +cat < content_types > +From: Todd > +To: t...@example.com > +Subject: odd content types > +Date: Mon, 12 Jan 2014 18:12:32 + > +User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 > (i486-pc-linux-gnu) > +Message-ID: > +MIME-Version: 1.0 > +Content-Type: multipart/alternative; boundary="==-=-==" > + > +--==-=-== > +Content-Type: application/unique_identifier > + > +This is an embedded message, with a multipart/alternative part. > + > +--==-=-== > +Content-Type: text/some_other_identifier > + > +This is an embedded message, with a multipart/alternative part. > + > +--==-=-==-- > +EOF > +cat content_types >> ${MAIL_DIR}/odd_content_type > notmuch new > /dev/null > > test_begin_subtest "--format=text --part=0, full message" > @@ -727,4 +751,12 @@ test_begin_subtest "html parts included" > notmuch show --format=json --include-html id:htmlmessage > OUTPUT > test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" > > +test_begin_subtest "indexes mime-type" test_subtest_known_broken > +output=$(notmuch search mimetype:application/unique_identifier | > notmuch_search_sanitize) > +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content > types (inbox unread)" > + test_begin_subtest "indexes mime-type #2" test_subtest_known_broken Then you'd remove test_subtest_known_broken when you add the feature. > +output=$(notmuch search mimetype:text/some_other_identifier | > notmuch_search_sanitize) > +test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content > types (inbox unread)" I think I'd like to see a subtest for searching mimetype:multipart/alternative (which should *not* find the message, IIUC). BR, Jani. > + > + > test_done > -- > 1.9.1 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: proposal: remove support for gmime2.4
On Thu, Jan 15 2015, David Bremner wrote: > It seems no very recent system has gmime2.4. I guess several of these > gmime2.4 only code paths are both security critical (e.g. in crypto.c) > and mostly untested. > > Is there good reason to keep supporting gmime 2.4? if there are potential security issues that we do not test (i.e. I do not test), then removing (instead of just deprecating) is a good option -- I'll just have to install gmime-2.6 on my Scientific Linux 6.2 system... Tomi > > d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
proposal: remove support for gmime2.4
It seems no very recent system has gmime2.4. I guess several of these gmime2.4 only code paths are both security critical (e.g. in crypto.c) and mostly untested. Is there good reason to keep supporting gmime 2.4? d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch