[PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > On Wed, Sep 24, 2014 at 09:25:20PM +0200, David Bremner wrote: >> I think the fact that you have to close the notmuch database (when >> not using begin/end atomic) to get a commit is surprising for many >> people, so it would be nice to make that clearer somehow. > > It looks like Xapian is GPLv2+, so we should just be able to > copy/paste/edit the line I quoted from the Xapian docs. > > Cheers, > Trevor I think it would be better to write our own, not because of licensing issues, but because the user of the notmuch API won't know what a xapian commit is. d
[PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > > Sorry, I didn't phrase that very well. The notmuch docs (as of this > patch) explain that we don't commit if we're in an atomic block. The > Xapian docs also say that, *and* they say that if we're not in atomic > block the close *does* try to commit. I think that's worth mentioning > in our close docs. OK, I see what you mean. I think the fact that you have to close the notmuch database (when not using begin/end atomic) to get a commit is surprising for many people, so it would be nice to make that clearer somehow. d
[PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > Ah, I thought the implicit flush/commit was just in our code. Since > it's also in the underlying Xapian close, then this patch looks pretty > good to me. I'd mention Xapian's explicit close in the notmuch. h > message. Xapain's docs say [1]: > > For a WritableDatabase, if a transaction is active it will be > aborted, while if no transaction is active commit() will be > implicitly called. I'm not sure what you're asking for here by "explicit close". Isn't what you quote a restatement of + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. in terms of underyling Xapian mechanics? P.S. Other than whatever this doc question is, the patch looks ok to me.
[PATCH] emacs: jump: fix compile warning on emacs 23
Mark Walters writes: > notmuch-jump uses window-body-width which is not defined in emacs > 23. To get around this it does > > (unless (fboundp 'window-body-width) > ;; Compatibility for Emacs pre-24 > (defalias 'window-body-width 'window-width)) pushed, d
[PATCH v3] lib: Simplify close and codify aborting atomic section
From: Austin Clements In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if there was an outstanding transaction (ie atomic section), commit would throw a Xapian exception, which notmuch_database_close would unnecessarily print to stderr, even though notmuch_database_close would ultimately abort the transaction anyway when it called close. This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the exception handling path, and codifies aborting outstanding transactions. This is currently the only way to abort an atomic section (and may remain so, since it would be difficult to roll back things we may have cached from rolled-back modifications). --- 'Doh. Left out the all-critical "git commit" before sending v2. lib/database.cc | 23 +++ lib/notmuch.h | 8 +++- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a3a7cd3..1f7ff2a 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -903,28 +903,19 @@ notmuch_database_close (notmuch_database_t *notmuch) { notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; -try { - if (notmuch->xapian_db != NULL && - notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE) - (static_cast (notmuch->xapian_db))->flush (); -} catch (const Xapian::Error &error) { - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; - if (! notmuch->exception_reported) { - fprintf (stderr, "Error: A Xapian exception occurred flushing database: %s\n", -error.get_msg().c_str()); - } -} - /* Many Xapian objects (and thus notmuch objects) hold references to * the database, so merely deleting the database may not suffice to - * close it. Thus, we explicitly close it here. */ + * close it. Thus, we explicitly close it here. This will + * implicitly abort any outstanding transaction and commit changes. */ if (notmuch->xapian_db != NULL) { try { notmuch->xapian_db->close(); } catch (const Xapian::Error &error) { - /* don't clobber previous error status */ - if (status == NOTMUCH_STATUS_SUCCESS) - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + if (! notmuch->exception_reported) { + fprintf (stderr, "Error: A Xapian exception occurred closing database: %s\n", +error.get_msg().c_str()); + } } } diff --git a/lib/notmuch.h b/lib/notmuch.h index fe2340b..49a3c79 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -281,7 +281,7 @@ notmuch_database_open (const char *path, notmuch_database_t **database); /** - * Close the given notmuch database. + * Commit changes and close the given notmuch database. * * After notmuch_database_close has been called, calls to other * functions on objects derived from this database may either behave @@ -292,6 +292,12 @@ notmuch_database_open (const char *path, * notmuch_database_close can be called multiple times. Later calls * have no effect. * + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. All + * changes up to this will be committed. + * * Return value: * * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. -- 2.1.0
[PATCH v2] lib: Simplify close and codify aborting atomic section
From: Austin Clements In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if there was an outstanding transaction (ie atomic section), commit would throw a Xapian exception, which notmuch_database_close would unnecessarily print to stderr, even though notmuch_database_close would ultimately abort the transaction anyway when it called close. This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the exception handling path, and codifies aborting outstanding transactions. This is currently the only way to abort an atomic section (and may remain so, since it would be difficult to roll back things we may have cached from rolled-back modifications). --- lib/database.cc | 23 +++ lib/notmuch.h | 5 + 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a3a7cd3..1f7ff2a 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -903,28 +903,19 @@ notmuch_database_close (notmuch_database_t *notmuch) { notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; -try { - if (notmuch->xapian_db != NULL && - notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE) - (static_cast (notmuch->xapian_db))->flush (); -} catch (const Xapian::Error &error) { - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; - if (! notmuch->exception_reported) { - fprintf (stderr, "Error: A Xapian exception occurred flushing database: %s\n", -error.get_msg().c_str()); - } -} - /* Many Xapian objects (and thus notmuch objects) hold references to * the database, so merely deleting the database may not suffice to - * close it. Thus, we explicitly close it here. */ + * close it. Thus, we explicitly close it here. This will + * implicitly abort any outstanding transaction and commit changes. */ if (notmuch->xapian_db != NULL) { try { notmuch->xapian_db->close(); } catch (const Xapian::Error &error) { - /* don't clobber previous error status */ - if (status == NOTMUCH_STATUS_SUCCESS) - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + if (! notmuch->exception_reported) { + fprintf (stderr, "Error: A Xapian exception occurred closing database: %s\n", +error.get_msg().c_str()); + } } } diff --git a/lib/notmuch.h b/lib/notmuch.h index fe2340b..5c40c67 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -292,6 +292,11 @@ notmuch_database_open (const char *path, * notmuch_database_close can be called multiple times. Later calls * have no effect. * + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. + * * Return value: * * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. -- 2.1.0
Re: [PATCH v3] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 05:32:50PM -0400, Austin Clements wrote: > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. All > + * changes up to this will be committed. I still think Xapian's wording is more readable [1]: For a WritableDatabase, if a transaction is active it will be aborted, while if no transaction is active commit() will be implicitly called. How about: For a writable database, if a transaction is active (there was a notmuch_database_begin_atomic without a matching notmuch_database_end_atomic) it will be aborted, while if no transaction is active any pending changes will be committed. Cheers, Trevor [1]: http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#a59f5f8b137723dcaaabdbdccbc0cf1eb -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v3] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 05:32:50PM -0400, Austin Clements wrote: > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. All > + * changes up to this will be committed. I still think Xapian's wording is more readable [1]: For a WritableDatabase, if a transaction is active it will be aborted, while if no transaction is active commit() will be implicitly called. How about: For a writable database, if a transaction is active (there was a notmuch_database_begin_atomic without a matching notmuch_database_end_atomic) it will be aborted, while if no transaction is active any pending changes will be committed. Cheers, Trevor [1]: http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#a59f5f8b137723dcaaabdbdccbc0cf1eb -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140924/b15fa880/attachment.pgp>
[PATCH v3] lib: Simplify close and codify aborting atomic section
From: Austin Clements In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if there was an outstanding transaction (ie atomic section), commit would throw a Xapian exception, which notmuch_database_close would unnecessarily print to stderr, even though notmuch_database_close would ultimately abort the transaction anyway when it called close. This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the exception handling path, and codifies aborting outstanding transactions. This is currently the only way to abort an atomic section (and may remain so, since it would be difficult to roll back things we may have cached from rolled-back modifications). --- 'Doh. Left out the all-critical "git commit" before sending v2. lib/database.cc | 23 +++ lib/notmuch.h | 8 +++- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a3a7cd3..1f7ff2a 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -903,28 +903,19 @@ notmuch_database_close (notmuch_database_t *notmuch) { notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; -try { - if (notmuch->xapian_db != NULL && - notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE) - (static_cast (notmuch->xapian_db))->flush (); -} catch (const Xapian::Error &error) { - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; - if (! notmuch->exception_reported) { - fprintf (stderr, "Error: A Xapian exception occurred flushing database: %s\n", -error.get_msg().c_str()); - } -} - /* Many Xapian objects (and thus notmuch objects) hold references to * the database, so merely deleting the database may not suffice to - * close it. Thus, we explicitly close it here. */ + * close it. Thus, we explicitly close it here. This will + * implicitly abort any outstanding transaction and commit changes. */ if (notmuch->xapian_db != NULL) { try { notmuch->xapian_db->close(); } catch (const Xapian::Error &error) { - /* don't clobber previous error status */ - if (status == NOTMUCH_STATUS_SUCCESS) - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + if (! notmuch->exception_reported) { + fprintf (stderr, "Error: A Xapian exception occurred closing database: %s\n", +error.get_msg().c_str()); + } } } diff --git a/lib/notmuch.h b/lib/notmuch.h index fe2340b..49a3c79 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -281,7 +281,7 @@ notmuch_database_open (const char *path, notmuch_database_t **database); /** - * Close the given notmuch database. + * Commit changes and close the given notmuch database. * * After notmuch_database_close has been called, calls to other * functions on objects derived from this database may either behave @@ -292,6 +292,12 @@ notmuch_database_open (const char *path, * notmuch_database_close can be called multiple times. Later calls * have no effect. * + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. All + * changes up to this will be committed. + * * Return value: * * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. -- 2.1.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 05:20:23PM -0400, Austin Clements wrote: > diff --git a/lib/notmuch.h b/lib/notmuch.h > index fe2340b..5c40c67 100644 > --- a/lib/notmuch.h > +++ b/lib/notmuch.h > @@ -292,6 +292,11 @@ notmuch_database_open (const char *path, > * notmuch_database_close can be called multiple times. Later calls > * have no effect. > * > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. > + * > * Return value: > * > * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. Still no mention of “commit” or “if you're not in an atomic section” ;). Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 05:20:23PM -0400, Austin Clements wrote: > diff --git a/lib/notmuch.h b/lib/notmuch.h > index fe2340b..5c40c67 100644 > --- a/lib/notmuch.h > +++ b/lib/notmuch.h > @@ -292,6 +292,11 @@ notmuch_database_open (const char *path, > * notmuch_database_close can be called multiple times. Later calls > * have no effect. > * > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. > + * > * Return value: > * > * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. Still no mention of ?commit? or ?if you're not in an atomic section? ;). Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140924/835307ba/attachment-0001.pgp>
[PATCH v2] lib: Simplify close and codify aborting atomic section
From: Austin Clements In Xapian, closing a database implicitly aborts any outstanding transaction and commits changes. For historical reasons, notmuch_database_close had grown to almost, but not quite duplicate this behavior. Before closing the database, it would explicitly (and unnecessarily) commit it. However, if there was an outstanding transaction (ie atomic section), commit would throw a Xapian exception, which notmuch_database_close would unnecessarily print to stderr, even though notmuch_database_close would ultimately abort the transaction anyway when it called close. This patch simplifies notmuch_database_close to just call Database::close. This works for both read-only and read/write databases, takes care of committing changes, unifies the exception handling path, and codifies aborting outstanding transactions. This is currently the only way to abort an atomic section (and may remain so, since it would be difficult to roll back things we may have cached from rolled-back modifications). --- lib/database.cc | 23 +++ lib/notmuch.h | 5 + 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a3a7cd3..1f7ff2a 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -903,28 +903,19 @@ notmuch_database_close (notmuch_database_t *notmuch) { notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; -try { - if (notmuch->xapian_db != NULL && - notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE) - (static_cast (notmuch->xapian_db))->flush (); -} catch (const Xapian::Error &error) { - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; - if (! notmuch->exception_reported) { - fprintf (stderr, "Error: A Xapian exception occurred flushing database: %s\n", -error.get_msg().c_str()); - } -} - /* Many Xapian objects (and thus notmuch objects) hold references to * the database, so merely deleting the database may not suffice to - * close it. Thus, we explicitly close it here. */ + * close it. Thus, we explicitly close it here. This will + * implicitly abort any outstanding transaction and commit changes. */ if (notmuch->xapian_db != NULL) { try { notmuch->xapian_db->close(); } catch (const Xapian::Error &error) { - /* don't clobber previous error status */ - if (status == NOTMUCH_STATUS_SUCCESS) - status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; + if (! notmuch->exception_reported) { + fprintf (stderr, "Error: A Xapian exception occurred closing database: %s\n", +error.get_msg().c_str()); + } } } diff --git a/lib/notmuch.h b/lib/notmuch.h index fe2340b..5c40c67 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -292,6 +292,11 @@ notmuch_database_open (const char *path, * notmuch_database_close can be called multiple times. Later calls * have no effect. * + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. + * * Return value: * * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. -- 2.1.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 10:13:31PM +0200, David Bremner wrote: > W. Trevor King writes: > I think it would be better to write our own, not because of licensing > issues, but because the user of the notmuch API won't know what a xapian > commit is. Between version control and databases, I feel like most folks using libnotmuch will know what a commit is ;). But I don't really mind, so long as the new docs mention it for non-atomic closes. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 10:13:31PM +0200, David Bremner wrote: > W. Trevor King writes: > I think it would be better to write our own, not because of licensing > issues, but because the user of the notmuch API won't know what a xapian > commit is. Between version control and databases, I feel like most folks using libnotmuch will know what a commit is ;). But I don't really mind, so long as the new docs mention it for non-atomic closes. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140924/2a98db8b/attachment.pgp>
Re: [PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > On Wed, Sep 24, 2014 at 09:25:20PM +0200, David Bremner wrote: >> I think the fact that you have to close the notmuch database (when >> not using begin/end atomic) to get a commit is surprising for many >> people, so it would be nice to make that clearer somehow. > > It looks like Xapian is GPLv2+, so we should just be able to > copy/paste/edit the line I quoted from the Xapian docs. > > Cheers, > Trevor I think it would be better to write our own, not because of licensing issues, but because the user of the notmuch API won't know what a xapian commit is. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 09:25:20PM +0200, David Bremner wrote: > I think the fact that you have to close the notmuch database (when > not using begin/end atomic) to get a commit is surprising for many > people, so it would be nice to make that clearer somehow. It looks like Xapian is GPLv2+, so we should just be able to copy/paste/edit the line I quoted from the Xapian docs. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 09:25:20PM +0200, David Bremner wrote: > I think the fact that you have to close the notmuch database (when > not using begin/end atomic) to get a commit is surprising for many > people, so it would be nice to make that clearer somehow. It looks like Xapian is GPLv2+, so we should just be able to copy/paste/edit the line I quoted from the Xapian docs. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140924/deb58ac9/attachment.pgp>
Re: [PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > > Sorry, I didn't phrase that very well. The notmuch docs (as of this > patch) explain that we don't commit if we're in an atomic block. The > Xapian docs also say that, *and* they say that if we're not in atomic > block the close *does* try to commit. I think that's worth mentioning > in our close docs. OK, I see what you mean. I think the fact that you have to close the notmuch database (when not using begin/end atomic) to get a commit is surprising for many people, so it would be nice to make that clearer somehow. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Emacs cheat sheet ?
Olivier Berger writes: > Hi. > > I kind of remember having seen a cheat sheet for Notmuch under emacs, > but cannot find anything conclusive... > > Did I dream of it ? ;-) > Could it be you remember the screen from "?" in notmuch-search or notmuch-show mode? d
Changing sort order in notmuch-show thread view (emacs) ?
Hi. Maybe this is obvious, but I can't figure out how to change the sort order from inside a threaded view when reviewing discussions in a thread, in Emacs. Using < removes thread indentation, but then I'm not sure what the sort order is : dates or order of navigating the tree of responses ? If I want to see latest messages in a discussion, instead of the default threaded view which is opened when I have entered a saved search view, can I do that from inside the notmuch-show buffer ? Many thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France)
Re: [PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 08:09:27PM +0200, David Bremner wrote: > W. Trevor King writes: > > Ah, I thought the implicit flush/commit was just in our code. > > Since it's also in the underlying Xapian close, then this patch > > looks pretty good to me. I'd mention Xapian's explicit close in > > the notmuch.h message. Xapain's docs say [1]: > > > > For a WritableDatabase, if a transaction is active it will be > > aborted, while if no transaction is active commit() will be > > implicitly called. > > I'm not sure what you're asking for here by "explicit close". Isn't > what you quote a restatement of > > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. > > in terms of underyling Xapian mechanics? Sorry, I didn't phrase that very well. The notmuch docs (as of this patch) explain that we don't commit if we're in an atomic block. The Xapian docs also say that, *and* they say that if we're not in atomic block the close *does* try to commit. I think that's worth mentioning in our close docs. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Simplify close and codify aborting atomic section
On Wed, Sep 24, 2014 at 08:09:27PM +0200, David Bremner wrote: > W. Trevor King writes: > > Ah, I thought the implicit flush/commit was just in our code. > > Since it's also in the underlying Xapian close, then this patch > > looks pretty good to me. I'd mention Xapian's explicit close in > > the notmuch.h message. Xapain's docs say [1]: > > > > For a WritableDatabase, if a transaction is active it will be > > aborted, while if no transaction is active commit() will be > > implicitly called. > > I'm not sure what you're asking for here by "explicit close". Isn't > what you quote a restatement of > > + * If the caller is currently in an atomic section (there was a > + * notmuch_database_begin_atomic without a matching > + * notmuch_database_end_atomic), this will abort the atomic section, > + * discarding any modifications made in the atomic section. > > in terms of underyling Xapian mechanics? Sorry, I didn't phrase that very well. The notmuch docs (as of this patch) explain that we don't commit if we're in an atomic block. The Xapian docs also say that, *and* they say that if we're not in atomic block the close *does* try to commit. I think that's worth mentioning in our close docs. Cheers, Trevor -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140924/90c2af76/attachment.pgp>
Emacs cheat sheet ?
Hi. I kind of remember having seen a cheat sheet for Notmuch under emacs, but cannot find anything conclusive... Did I dream of it ? ;-) Many thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France)
Re: [PATCH] lib: Simplify close and codify aborting atomic section
"W. Trevor King" writes: > Ah, I thought the implicit flush/commit was just in our code. Since > it's also in the underlying Xapian close, then this patch looks pretty > good to me. I'd mention Xapian's explicit close in the notmuch. h > message. Xapain's docs say [1]: > > For a WritableDatabase, if a transaction is active it will be > aborted, while if no transaction is active commit() will be > implicitly called. I'm not sure what you're asking for here by "explicit close". Isn't what you quote a restatement of + * If the caller is currently in an atomic section (there was a + * notmuch_database_begin_atomic without a matching + * notmuch_database_end_atomic), this will abort the atomic section, + * discarding any modifications made in the atomic section. in terms of underyling Xapian mechanics? P.S. Other than whatever this doc question is, the patch looks ok to me. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: jump: fix compile warning on emacs 23
Mark Walters writes: > notmuch-jump uses window-body-width which is not defined in emacs > 23. To get around this it does > > (unless (fboundp 'window-body-width) > ;; Compatibility for Emacs pre-24 > (defalias 'window-body-width 'window-width)) pushed, d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v5] nmbug: Translate to Python
This allows us to capture stdout and stderr separately, and do other explicit subprocess manipulation without resorting to external packages. It should be compatible with Python 2.6 and later (including the 3.x series), although with 2.6 you'll need the external argparse package. Most of the user-facing interface is the same, but there are a few changes, where reproducing the original interface was too difficult or I saw a change to make the underlying Git UI accessible: * 'nmbug help' has been split between the general 'nmbug --help' and the command-specific 'nmbug COMMAND --help'. * Commands are no longer split into "most common", "other useful", and "less common" sets. If we need something like this, I'd prefer workflow examples highlighting common commands in the module docstring (available with 'nmbug --help'). * 'nmbug commit' now only uses a single argument for the optional commit-message text. I wanted to expose more of the underlying 'git commit' UI, since I personally like to write my commit messages in an editor with the notes added by 'git commit -v' to jog my memory. Unfortunately, we're using 'git commit-tree' instead of 'git commit', and commit-tree is too low-level for editor-launching. I'd be interested in rewriting commit() to use 'git commit', but that seemed like it was outside the scope of this rewrite. So I'm not supporting all of Git's commit syntax in this patch, but I can at least match 'git commit -m MESSAGE' in requiring command-line commit messages to be a single argument. * The default repository for 'nmbug push' and 'nmbug fetch' is now the current branch's upstream (branch..remote) instead of 'origin'. When we have to, we extract this remote by hand, but where possible we just call the Git command without a repository argument, and leave it to Git to figure out the default. * 'nmbug push' accepts multiple refspecs if you want to explicitly specify what to push. Otherwise, the refspec(s) pushed depend on push.default. The Perl version hardcoded 'master' as the pushed refspec. * 'nmbug pull' defaults to the current branch's upstream (branch..remote and branch..merge) instead of hardcoding 'origin' and 'master'. It also supports multiple refspecs if for some crazy reason you need an octopus merge (but mostly to avoid breaking consistency with 'git pull'). * 'nmbug log' now execs 'git log', as there's no need to keep the Python process around once we've launched Git there. * 'nmbug status' now catches stderr, and doesn't print errors like: No upstream configured for branch 'master' The Perl implementation had just learned to avoid crashing on that case, but wasn't yet catching the dying subprocess's stderr. * 'nmbug archive' now accepts positional arguments for the tree-ish and additional 'git archive' options. For example, you can run: $ nmbug archive HEAD -- --format tar.gz I wish I could have preserved the argument order from 'git archive' (with the tree-ish at the end), but I'm not sure how to make argparse accept arbitrary possitional arguments (some of which take arguments). Flipping the order to put the tree-ish first seemed easiest. * 'nmbug merge' and 'pull' no longer checkout HEAD before running their command, because blindly clobbering the index seems overly risky. * In order to avoid creating a dirty index, 'nmbug commit' now uses the default index (instead of nmbug.index) for composing the commit. That way the index matches the committed tree. To avoid leaving a broken index after a failed commit, I've wrapped the whole thing in a try/except block that resets the index to match the pre-commit treeish on errors. That means that 'nmbug commit' will ignore anything you've cached in the index via direct Git calls, and you'll either end up with an index matching your notmuch tags and the new HEAD (after a successful commit) or an index matching the original HEAD (after a failed commit). --- Changes since v4 [1]: * Use locale.getpreferredencoding() instead of sys.stdout.encoding to guess the encoding for the input/output streams of spawned processes. In Python 2, sys.stdout.encoding is None when stdout isn't a TTY, so we need to avoid it if we want to redirect logs to files. * Drop _read_tree(), since wrapping two Git calls isn't worth the trouble. * Use the default index (instead of nmbug.index) in commit(). Details in the final list entry of the commit message. This will make it harder to commit non-HEAD branches (because we're clobbering the default index), but I don't see a need to do that anyway (and the nmbug UI has never supported it). Cheers, Trevor [1]: id:e630b6763e9d0771718afee41ea15b29bb4a1de8.1409935538.git.wk...@tremily.us http://article.gmane.org/gmane.mail.notmuch.general/19007 devel/nmbug/nmbug | 1515 - 1 file changed, 807 insertions(+), 708 deletio
[PATCH v5] nmbug: Translate to Python
This allows us to capture stdout and stderr separately, and do other explicit subprocess manipulation without resorting to external packages. It should be compatible with Python 2.6 and later (including the 3.x series), although with 2.6 you'll need the external argparse package. Most of the user-facing interface is the same, but there are a few changes, where reproducing the original interface was too difficult or I saw a change to make the underlying Git UI accessible: * 'nmbug help' has been split between the general 'nmbug --help' and the command-specific 'nmbug COMMAND --help'. * Commands are no longer split into "most common", "other useful", and "less common" sets. If we need something like this, I'd prefer workflow examples highlighting common commands in the module docstring (available with 'nmbug --help'). * 'nmbug commit' now only uses a single argument for the optional commit-message text. I wanted to expose more of the underlying 'git commit' UI, since I personally like to write my commit messages in an editor with the notes added by 'git commit -v' to jog my memory. Unfortunately, we're using 'git commit-tree' instead of 'git commit', and commit-tree is too low-level for editor-launching. I'd be interested in rewriting commit() to use 'git commit', but that seemed like it was outside the scope of this rewrite. So I'm not supporting all of Git's commit syntax in this patch, but I can at least match 'git commit -m MESSAGE' in requiring command-line commit messages to be a single argument. * The default repository for 'nmbug push' and 'nmbug fetch' is now the current branch's upstream (branch..remote) instead of 'origin'. When we have to, we extract this remote by hand, but where possible we just call the Git command without a repository argument, and leave it to Git to figure out the default. * 'nmbug push' accepts multiple refspecs if you want to explicitly specify what to push. Otherwise, the refspec(s) pushed depend on push.default. The Perl version hardcoded 'master' as the pushed refspec. * 'nmbug pull' defaults to the current branch's upstream (branch..remote and branch..merge) instead of hardcoding 'origin' and 'master'. It also supports multiple refspecs if for some crazy reason you need an octopus merge (but mostly to avoid breaking consistency with 'git pull'). * 'nmbug log' now execs 'git log', as there's no need to keep the Python process around once we've launched Git there. * 'nmbug status' now catches stderr, and doesn't print errors like: No upstream configured for branch 'master' The Perl implementation had just learned to avoid crashing on that case, but wasn't yet catching the dying subprocess's stderr. * 'nmbug archive' now accepts positional arguments for the tree-ish and additional 'git archive' options. For example, you can run: $ nmbug archive HEAD -- --format tar.gz I wish I could have preserved the argument order from 'git archive' (with the tree-ish at the end), but I'm not sure how to make argparse accept arbitrary possitional arguments (some of which take arguments). Flipping the order to put the tree-ish first seemed easiest. * 'nmbug merge' and 'pull' no longer checkout HEAD before running their command, because blindly clobbering the index seems overly risky. * In order to avoid creating a dirty index, 'nmbug commit' now uses the default index (instead of nmbug.index) for composing the commit. That way the index matches the committed tree. To avoid leaving a broken index after a failed commit, I've wrapped the whole thing in a try/except block that resets the index to match the pre-commit treeish on errors. That means that 'nmbug commit' will ignore anything you've cached in the index via direct Git calls, and you'll either end up with an index matching your notmuch tags and the new HEAD (after a successful commit) or an index matching the original HEAD (after a failed commit). --- Changes since v4 [1]: * Use locale.getpreferredencoding() instead of sys.stdout.encoding to guess the encoding for the input/output streams of spawned processes. In Python 2, sys.stdout.encoding is None when stdout isn't a TTY, so we need to avoid it if we want to redirect logs to files. * Drop _read_tree(), since wrapping two Git calls isn't worth the trouble. * Use the default index (instead of nmbug.index) in commit(). Details in the final list entry of the commit message. This will make it harder to commit non-HEAD branches (because we're clobbering the default index), but I don't see a need to do that anyway (and the nmbug UI has never supported it). Cheers, Trevor [1]: id:e630b6763e9d0771718afee41ea15b29bb4a1de8.1409935538.git.wking at tremily.us http://article.gmane.org/gmane.mail.notmuch.general/19007 devel/nmbug/nmbug | 1515 - 1 file changed, 807 insertions(+), 708 del
Re: Emacs cheat sheet ?
Olivier Berger writes: > Hi. > > I kind of remember having seen a cheat sheet for Notmuch under emacs, > but cannot find anything conclusive... > > Did I dream of it ? ;-) > Could it be you remember the screen from "?" in notmuch-search or notmuch-show mode? d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Changing sort order in notmuch-show thread view (emacs) ?
Hi. Maybe this is obvious, but I can't figure out how to change the sort order from inside a threaded view when reviewing discussions in a thread, in Emacs. Using < removes thread indentation, but then I'm not sure what the sort order is : dates or order of navigating the tree of responses ? If I want to see latest messages in a discussion, instead of the default threaded view which is opened when I have entered a saved search view, can I do that from inside the notmuch-show buffer ? Many thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Emacs cheat sheet ?
Hi. I kind of remember having seen a cheat sheet for Notmuch under emacs, but cannot find anything conclusive... Did I dream of it ? ;-) Many thanks in advance. Best regards, -- Olivier BERGER http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 Ingenieur Recherche - Dept INF Institut Mines-Telecom, Telecom SudParis, Evry (France) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch