+
+ config = notmuch_config_open (ctx, NULL, NULL);
+ if (config == NULL)
+ return 1;
+
+ notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
+ if (notmuch == NULL)
+ return 1;
+
+ query = notmuch_query_create (notmuch, "");
+ if (query == NULL) {
+ fprintf (stderr, "Out of memory\n");
+ return 1;
+ }
+ notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);