[PATCH v2] emacs: do not modify subject in search or show
Jameson Graef Rollins writes: > A previous patch [0] replaced blank subject lines with '[No Subject]' > in search and show mode. pushed. d
[Patch v4 1/3] emacs: split notmuch-show-apply-state
Hmm. I think this will wind up spuriously marking messages read. If notmuch-show-refresh-view is called with reset-state set to t, it will mark the first open message read, before you move to the previously current message. IMO, notmuch-show-refresh-view should not be marking messages read at all, but I tried to separate out that functionality before and failed. Perhaps you can find a good way to do it. A more incremental but slightly lame approach could be to pass some symbol for reset-state that indicates it should reset the open state, but not the position... and not mark anything read. Ugh. Quoth Mark Walters on Apr 29 at 1:06 am: > Separate out a notmuch-show-goto-msg-id sub-function from > notmuch-show-apply-state. There should be no functional change but the > next patch will call the new function. > --- > emacs/notmuch-show.el | 18 +++--- > 1 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 30b26d1..3bd9a64 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1085,6 +1085,16 @@ This includes: > - the current message." >(list (notmuch-show-get-message-id) > (notmuch-show-get-message-ids-for-open-messages))) > > +(defun notmuch-show-goto-message (msg-id) > + "Go to message with msg-id." > + (goto-char (point-min)) > + (unless (loop if (string= msg-id (notmuch-show-get-message-id)) > + return t > + until (not (notmuch-show-goto-message-next))) > +(goto-char (point-min)) > +(message "Message-id not found.")) > + (notmuch-show-message-adjust)) > + > (defun notmuch-show-apply-state (state) >"Apply STATE to the current buffer. > > @@ -1102,13 +1112,7 @@ This includes: > until (not (notmuch-show-goto-message-next))) > > ;; Go to the previously open message. > -(goto-char (point-min)) > -(unless (loop if (string= current (notmuch-show-get-message-id)) > - return t > - until (not (notmuch-show-goto-message-next))) > - (goto-char (point-min)) > - (message "Previously current message not found.")) > -(notmuch-show-message-adjust))) > +(notmuch-show-goto-message current))) > > (defun notmuch-show-refresh-view (&optional reset-state) >"Refresh the current view. -- Austin Clements MIT/'06/PhD/CSAIL amdragon at mit.edu http://web.mit.edu/amdragon Somewhere in the dream we call reality you will find me, searching for the reality we call dreams.
[ANN] New awesome vim plug-in using Ruby bindings
Hi Felipe, On Thu, Apr 26, 2012 at 8:29 AM, Felipe Contreras wrote: > In case anybody is interested, here's a screencast showing some of the > features :) > http://youtu.be/JGD7IbZmnIs This looks great, but I can't seem to be able to get it to work on my machine. I have put notmuch-ruby.vim alongside notmuch.vim inside .vim/plugin, and the .vim/syntax/notmuch-* files are there as well. If I do vim -c ':NotMuch' I can get into the normal vim frontend for notmuch, but if I try vim -c ':NotMuchR' all I get is an error message: Error detected while processing command line: E492: Not an editor command: :NotMuchR Sorry about the completely noob question, but I've been unsuccessfully trying to get this to work for a while now and I have run out of ideas. I'm of course happy to provide whatever information would help get to the bottom of this. -- Best, Alex -- Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne http://aghitza.org
Re: [PATCH v2] emacs: do not modify subject in search or show
Jameson Graef Rollins writes: > A previous patch [0] replaced blank subject lines with '[No Subject]' > in search and show mode. pushed. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
priorities for 0.13
Quoth David Bremner on Apr 25 at 9:31 am: > > Hi All; > > I'd like to have a feature freeze for 0.13 sometime in the first week of > May. What do people feel are priorities to try to get reviewed and > pushed for 0.13? I've posted the changes to notmuch_database_{open,create} that we've discussed would be nice to go in along with the SO version bump: id:"1335651473-19652-1-git-send-email-amdragon at mit.edu" Just to keep track of things, I also posted a patch to bump the SO version: id:"1335651936-27209-1-git-send-email-amdragon at mit.edu" But feel free to do that however's most convenient.
[Patch v3 0/2] Add filter to emacs show mode
LGTM. It's too bad limiting will loose point, but obviously that can be fixed later. Quoth Mark Walters on Apr 26 at 8:14 pm: > Version 3 of this patch set: previous version is at > id:"1335373954-4578-1-git-send-email-markwalters1009 at gmail.com". > > This is updated to use Tomi's much cleaner version for the lisp. > > > Mark Walters (2): > emacs: add a filter option to show > emacs: Bind filter in search to 'l' > > emacs/notmuch-show.el | 10 ++ > emacs/notmuch.el |4 ++-- > 2 files changed, 12 insertions(+), 2 deletions(-)
[PATCH] NEWS: add news item for 'config list'
--- NEWS |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/NEWS b/NEWS index a2cd080..4f36dff 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,11 @@ Raw show format changes encoded in the original message, including the part's headers. Leaf parts, as before, output the part's transfer-decoded body. +Listing configuration items + + The new "config list" command prints out all configuration items and + their values. + Emacs Interface --- -- 1.7.4.4 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Bump SO version from 2.0.0 to 3.0.0
We've changed the APIs of notmuch_database_open, notmuch_database_create, and notmuch_database_close. --- Some of this patch's context comes from id:"1335651473-19652-1-git-send-email-amdragon at mit.edu", so it won't apply cleanly without that. NEWS |3 +++ lib/Makefile.local |2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index 0f031f3..0e8c099 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,9 @@ contrib/ from now on. Library changes --- +The API changes detailed below break binary and source compatibility, +so libnotmuch has been bumped to version 3.0.0. + The function notmuch_database_close has been split into notmuch_database_close and notmuch_database_destroy diff --git a/lib/Makefile.local b/lib/Makefile.local index 54c4dea..8a9aa28 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -5,7 +5,7 @@ # the library interface, (such as the deletion of an API or a major # semantic change that breaks formerly functioning code). # -LIBNOTMUCH_VERSION_MAJOR = 2 +LIBNOTMUCH_VERSION_MAJOR = 3 # The minor version of the library interface. This should be incremented at # the time of release for any additions to the library interface, -- 1.7.9.1
[PATCH 6/6] News for changes to notmuch_database_{open,create}
--- NEWS | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index a2cd080..0f031f3 100644 --- a/NEWS +++ b/NEWS @@ -76,15 +76,20 @@ contrib/ from now on. Library changes --- -API changes - - The function notmuch_database_close has been split into - notmuch_database_close and notmuch_database_destroy. +The function notmuch_database_close has been split into +notmuch_database_close and notmuch_database_destroy This makes it possible for long running programs to close the xapian database and thus release the lock associated with it without destroying the data structures obtained from it. +notmuch_database_open and notmuch_database_create now return errors + + The type signatures of notmuch_database_open and + notmuch_database_create have changed so that the functions now + return a notmuch_status_t and take an out-argument for returning the + new database object. + Notmuch 0.12 (2012-03-20) = -- 1.7.9.1
[PATCH 5/6] ruby: Update Ruby bindings for new notmuch_database_{open, create} signatures
--- bindings/ruby/database.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index ba9a139..409d54f 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -42,6 +42,8 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) int create, mode; VALUE pathv, hashv; VALUE modev; +notmuch_database_t *database; +notmuch_status_t ret; /* Check arguments */ rb_scan_args (argc, argv, "11", &pathv, &hashv); @@ -73,9 +75,13 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) } Check_Type (self, T_DATA); -DATA_PTR (self) = create ? notmuch_database_create (path) : notmuch_database_open (path, mode); -if (!DATA_PTR (self)) - rb_raise (notmuch_rb_eDatabaseError, "Failed to open database"); +if (create) + ret = notmuch_database_create (path, &database); +else + ret = notmuch_database_open (path, mode, &database); +notmuch_rb_status_raise (ret); + +DATA_PTR (self) = database; return self; } -- 1.7.9.1
[PATCH 4/6] python: Update Python bindings for new notmuch_database_{open, create} signatures
--- bindings/python/notmuch/database.py | 29 - 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 268e952..adc0a3f 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -95,8 +95,8 @@ class Database(object): """notmuch_database_open""" _open = nmlib.notmuch_database_open -_open.argtypes = [c_char_p, c_uint] -_open.restype = NotmuchDatabaseP +_open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)] +_open.restype = c_uint """notmuch_database_upgrade""" _upgrade = nmlib.notmuch_database_upgrade @@ -122,8 +122,8 @@ class Database(object): """notmuch_database_create""" _create = nmlib.notmuch_database_create -_create.argtypes = [c_char_p] -_create.restype = NotmuchDatabaseP +_create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)] +_create.restype = c_uint def __init__(self, path = None, create = False, mode = MODE.READ_ONLY): @@ -193,12 +193,13 @@ class Database(object): raise NotmuchError(message="Cannot create db, this Database() " "already has an open one.") -res = Database._create(_str(path), Database.MODE.READ_WRITE) +db = NotmuchDatabaseP() +status = Database._create(_str(path), Database.MODE.READ_WRITE, byref(db)) -if not res: -raise NotmuchError( -message="Could not create the specified database") -self._db = res +if status != STATUS.SUCCESS: +raise NotmuchError(status) +self._db = db +return status def open(self, path, mode=0): """Opens an existing database @@ -212,11 +213,13 @@ class Database(object): :raises: Raises :exc:`NotmuchError` in case of any failure (possibly after printing an error message on stderr). """ -res = Database._open(_str(path), mode) +db = NotmuchDatabaseP() +status = Database._open(_str(path), mode, byref(db)) -if not res: -raise NotmuchError(message="Could not open the specified database") -self._db = res +if status != STATUS.SUCCESS: +raise NotmuchError(status) +self._db = db +return status _close = nmlib.notmuch_database_close _close.argtypes = [NotmuchDatabaseP] -- 1.7.9.1
[PATCH 3/6] go: Update Go bindings for new notmuch_database_{open, create} signatures
This requires changing the return types of NewDatabase and OpenDatabase to follow the standard Go convention for returning errors. --- bindings/go/pkg/notmuch.go | 24 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index d32901d..86e9645 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -86,21 +86,21 @@ const ( ) // Create a new, empty notmuch database located at 'path' -func NewDatabase(path string) *Database { +func NewDatabase(path string) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_create(c_path) - if self.db == nil { - return nil + st := Status(C.notmuch_database_create(c_path, &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Open an existing notmuch database located at 'path'. @@ -120,21 +120,21 @@ func NewDatabase(path string) *Database { * In case of any failure, this function returns NULL, (after printing * an error message on stderr). */ -func OpenDatabase(path string, mode DatabaseMode) *Database { +func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode)) - if self.db == nil { - return nil + st := Status(C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode), &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Close the given notmuch database, freeing all associated -- 1.7.9.1
[PATCH 2/6] lib/cli: Make notmuch_database_create return a status code
This is the notmuch_database_create equivalent of the previous change. In this case, there were places where errors were not being propagated correctly in notmuch_database_create or in calls to it. These have been fixed, using the new status value. --- lib/database.cc | 26 +++--- lib/notmuch.h |8 notmuch-new.c |3 ++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a29fe67..a3ae504 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -520,9 +520,10 @@ parse_references (void *ctx, } } -notmuch_database_t * -notmuch_database_create (const char *path) +notmuch_status_t +notmuch_database_create (const char *path, notmuch_database_t **database) { +notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; notmuch_database_t *notmuch = NULL; char *notmuch_path = NULL; struct stat st; @@ -530,6 +531,7 @@ notmuch_database_create (const char *path) if (path == NULL) { fprintf (stderr, "Error: Cannot create a database for a NULL path.\n"); + status = NOTMUCH_STATUS_NULL_POINTER; goto DONE; } @@ -537,12 +539,14 @@ notmuch_database_create (const char *path) if (err) { fprintf (stderr, "Error: Cannot create database at %s: %s.\n", path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (! S_ISDIR (st.st_mode)) { fprintf (stderr, "Error: Cannot create database at %s: Not a directory.\n", path); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } @@ -553,19 +557,27 @@ notmuch_database_create (const char *path) if (err) { fprintf (stderr, "Error: Cannot create directory %s: %s.\n", notmuch_path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } -notmuch_database_open (path, - NOTMUCH_DATABASE_MODE_READ_WRITE, - ¬much); -notmuch_database_upgrade (notmuch, NULL, NULL); +status = notmuch_database_open (path, + NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much); +if (status) + goto DONE; +status = notmuch_database_upgrade (notmuch, NULL, NULL); +if (status) { + notmuch_database_close(notmuch); + notmuch = NULL; +} DONE: if (notmuch_path) talloc_free (notmuch_path); -return notmuch; +*database = notmuch; +return status; } notmuch_status_t diff --git a/lib/notmuch.h b/lib/notmuch.h index 8a011f2..d880aeb 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -140,11 +140,11 @@ typedef struct _notmuch_filenames notmuch_filenames_t; * contained within 'path' can be added to the database by calling * notmuch_database_add_message. * - * In case of any failure, this function returns NULL, (after printing - * an error message on stderr). + * In case of any failure, this function returns an error status and + * sets *database to NULL (after printing an error message on stderr). */ -notmuch_database_t * -notmuch_database_create (const char *path); +notmuch_status_t +notmuch_database_create (const char *path, notmuch_database_t **database); typedef enum { NOTMUCH_DATABASE_MODE_READ_ONLY = 0, diff --git a/notmuch-new.c b/notmuch-new.c index 7788743..cb720cc 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -900,7 +900,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) return 1; printf ("Found %d total files (that's not much mail).\n", count); - notmuch = notmuch_database_create (db_path); + if (notmuch_database_create (db_path, ¬much)) + return 1; add_files_state.total_files = count; } else { if (notmuch_database_open (db_path, NOTMUCH_DATABASE_MODE_READ_WRITE, -- 1.7.9.1
[PATCH 1/6] lib/cli: Make notmuch_database_open return a status code
It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails. --- lib/database.cc | 19 ++- lib/notmuch.h | 12 +--- notmuch-count.c |5 ++--- notmuch-dump.c |5 ++--- notmuch-new.c |5 ++--- notmuch-reply.c |5 ++--- notmuch-restore.c |5 ++--- notmuch-search.c|5 ++--- notmuch-show.c |5 ++--- notmuch-tag.c |5 ++--- test/symbol-test.cc |3 ++- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 2fefcad..a29fe67 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -556,8 +556,9 @@ notmuch_database_create (const char *path) goto DONE; } -notmuch = notmuch_database_open (path, -NOTMUCH_DATABASE_MODE_READ_WRITE); +notmuch_database_open (path, + NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much); notmuch_database_upgrade (notmuch, NULL, NULL); DONE: @@ -578,10 +579,12 @@ _notmuch_database_ensure_writable (notmuch_database_t *notmuch) return NOTMUCH_STATUS_SUCCESS; } -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode) + notmuch_database_mode_t mode, + notmuch_database_t **database) { +notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; void *local = talloc_new (NULL); notmuch_database_t *notmuch = NULL; char *notmuch_path, *xapian_path; @@ -592,6 +595,7 @@ notmuch_database_open (const char *path, if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -599,11 +603,13 @@ notmuch_database_open (const char *path, if (err) { fprintf (stderr, "Error opening database at %s: %s\n", notmuch_path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, "xapian"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -644,6 +650,7 @@ notmuch_database_open (const char *path, notmuch->mode = NOTMUCH_DATABASE_MODE_READ_ONLY; notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } @@ -704,12 +711,14 @@ notmuch_database_open (const char *path, error.get_msg().c_str()); notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; } DONE: talloc_free (local); -return notmuch; +*database = notmuch; +return status; } void diff --git a/lib/notmuch.h b/lib/notmuch.h index 7d9e092..8a011f2 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -151,9 +151,6 @@ typedef enum { NOTMUCH_DATABASE_MODE_READ_WRITE } notmuch_database_mode_t; -/* XXX: I think I'd like this to take an extra argument of - * notmuch_status_t* for returning a status value on failure. */ - /* Open an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, @@ -168,12 +165,13 @@ typedef enum { * The caller should call notmuch_database_destroy when finished with * this database. * - * In case of any failure, this function returns NULL, (after printing - * an error message on stderr). + * In case of any failure, this function returns an error status and + * sets *database to NULL (after printing an error message on stderr). */ -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode); + notmuch_database_mode_t mode, + notmuch_database_t **database); /* Close the given notmuch database. * diff --git a/notmuch-count.c b/notmuch-count.c index 9c2ad7b..2f98128 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -66,9 +66,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; -notmuch = notmuch_database_open (notmuch_config_get_database_path (config), -NOTMUCH_DATABASE_MODE_READ_ONLY); -if (notmuch == NULL) +if (notmuch_database_open (notmuch_config_get_database_path (config),
[PATCH 0/6] Make notmuch_database_{open,create} return status codes
Since we're breaking binary and source compatibility with the next release anyway, it's about time we fix notmuch_database_{open,create} to return status codes.
Re: [Patch v4 1/3] emacs: split notmuch-show-apply-state
Hmm. I think this will wind up spuriously marking messages read. If notmuch-show-refresh-view is called with reset-state set to t, it will mark the first open message read, before you move to the previously current message. IMO, notmuch-show-refresh-view should not be marking messages read at all, but I tried to separate out that functionality before and failed. Perhaps you can find a good way to do it. A more incremental but slightly lame approach could be to pass some symbol for reset-state that indicates it should reset the open state, but not the position... and not mark anything read. Ugh. Quoth Mark Walters on Apr 29 at 1:06 am: > Separate out a notmuch-show-goto-msg-id sub-function from > notmuch-show-apply-state. There should be no functional change but the > next patch will call the new function. > --- > emacs/notmuch-show.el | 18 +++--- > 1 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 30b26d1..3bd9a64 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1085,6 +1085,16 @@ This includes: > - the current message." >(list (notmuch-show-get-message-id) > (notmuch-show-get-message-ids-for-open-messages))) > > +(defun notmuch-show-goto-message (msg-id) > + "Go to message with msg-id." > + (goto-char (point-min)) > + (unless (loop if (string= msg-id (notmuch-show-get-message-id)) > + return t > + until (not (notmuch-show-goto-message-next))) > +(goto-char (point-min)) > +(message "Message-id not found.")) > + (notmuch-show-message-adjust)) > + > (defun notmuch-show-apply-state (state) >"Apply STATE to the current buffer. > > @@ -1102,13 +1112,7 @@ This includes: > until (not (notmuch-show-goto-message-next))) > > ;; Go to the previously open message. > -(goto-char (point-min)) > -(unless (loop if (string= current (notmuch-show-get-message-id)) > - return t > - until (not (notmuch-show-goto-message-next))) > - (goto-char (point-min)) > - (message "Previously current message not found.")) > -(notmuch-show-message-adjust))) > +(notmuch-show-goto-message current))) > > (defun notmuch-show-refresh-view (&optional reset-state) >"Refresh the current view. -- Austin Clements MIT/'06/PhD/CSAIL amdra...@mit.edu http://web.mit.edu/amdragon Somewhere in the dream we call reality you will find me, searching for the reality we call dreams. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] go: Update to the current notmuch_database_find_message API
The signature of notmuch_database_find_message was changed in 02a30767 to report errors and the Go bindings were never updated. This brings the Go bindings in sync with that change and at least makes them compile with Go r60.3, the last release before Go 1. --- bindings/go/pkg/notmuch.go | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index c6844ef..8fe400b 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -306,20 +306,21 @@ func (self *Database) RemoveMessage(fname string) Status { * * An out-of-memory situation occurs * * A Xapian exception occurs */ -func (self *Database) FindMessage(message_id string) *Message { +func (self *Database) FindMessage(message_id string) (*Message, Status) { var c_msg_id *C.char = C.CString(message_id) defer C.free(unsafe.Pointer(c_msg_id)) if c_msg_id == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } - msg := C.notmuch_database_find_message(self.db, c_msg_id) - if msg == nil { - return nil + msg := &Message{message:nil} + st := Status(C.notmuch_database_find_message(self.db, c_msg_id, &msg.message)) + if st != STATUS_SUCCESS { + return nil, st } - return &Message{message:msg} + return msg, st } /* Return a list of all tags found in the database. -- 1.7.9.1
[Patch v4 3/3] emacs: Bind filter in search to 'l'
Change the key binding for filter (or "limit") in search-mode. This gives consistency with the new filter in show-mode, and frees 'f' for forward-thread in the future. --- emacs/notmuch.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 736d00f..3df826c 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -286,7 +286,7 @@ For a mouse binding, return nil." (define-key map "=" 'notmuch-search-refresh-view) (define-key map "G" 'notmuch-search-poll-and-refresh-view) (define-key map "t" 'notmuch-search-filter-by-tag) -(define-key map "f" 'notmuch-search-filter) +(define-key map "l" 'notmuch-search-filter) (define-key map [mouse-1] 'notmuch-search-show-thread) (define-key map "*" 'notmuch-search-tag-all) (define-key map "a" 'notmuch-search-archive-thread) @@ -1095,7 +1095,7 @@ search." (notmuch-search-refresh-view)) (defun notmuch-search-filter (query) - "Filter the current search results based on an additional query string. + "Filter or LIMIT the current search results based on an additional query string. Runs a new search matching only messages that match both the current search results AND the additional query string provided." -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[Patch v4 2/3] emacs: add a filter option to show
Show the current thread with a different filter (i.e., open messages in the thread matching the new query). Bound to 'l' for "limit". Note that it is not the same as filter in search mode as it replaces the existing query rather than ANDing with it (but it does keep the thread-id part of the query). --- emacs/notmuch-show.el | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 3bd9a64..f52a96d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -42,6 +42,7 @@ (declare-function notmuch-search-next-thread "notmuch" nil) (declare-function notmuch-search-show-thread "notmuch" nil) (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes)) +(declare-function notmuch-read-query "notmuch" (prompt)) (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") "Headers that should be shown in a message, in this order. @@ -1161,6 +1162,7 @@ reset based on the original query." (define-key map "s" 'notmuch-search) (define-key map "m" 'notmuch-mua-new-mail) (define-key map "f" 'notmuch-show-forward-message) + (define-key map "l" 'notmuch-show-filter-thread) (define-key map "r" 'notmuch-show-reply-sender) (define-key map "R" 'notmuch-show-reply) (define-key map "|" 'notmuch-show-pipe-message) @@ -1403,6 +1405,16 @@ current thread." "Mark the current message as read." (notmuch-show-tag-message "-unread")) +(defun notmuch-show-filter-thread (query) + "Filter or LIMIT the current thread based on a new query string. + +Reshows the current thread with matches defined by the new query-string." + (interactive (list (notmuch-read-query "Filter thread: "))) + (let ((msg-id (notmuch-show-get-message-id))) +(setq notmuch-show-query-context (if (string= query "") nil query)) +(notmuch-show-refresh-view t) +(notmuch-show-goto-message msg-id))) + ;; Functions for getting attributes of several messages in the current ;; thread. -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[Patch v4 1/3] emacs: split notmuch-show-apply-state
Separate out a notmuch-show-goto-msg-id sub-function from notmuch-show-apply-state. There should be no functional change but the next patch will call the new function. --- emacs/notmuch-show.el | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 30b26d1..3bd9a64 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1085,6 +1085,16 @@ This includes: - the current message." (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages))) +(defun notmuch-show-goto-message (msg-id) + "Go to message with msg-id." + (goto-char (point-min)) + (unless (loop if (string= msg-id (notmuch-show-get-message-id)) + return t + until (not (notmuch-show-goto-message-next))) +(goto-char (point-min)) +(message "Message-id not found.")) + (notmuch-show-message-adjust)) + (defun notmuch-show-apply-state (state) "Apply STATE to the current buffer. @@ -1102,13 +1112,7 @@ This includes: until (not (notmuch-show-goto-message-next))) ;; Go to the previously open message. -(goto-char (point-min)) -(unless (loop if (string= current (notmuch-show-get-message-id)) - return t - until (not (notmuch-show-goto-message-next))) - (goto-char (point-min)) - (message "Previously current message not found.")) -(notmuch-show-message-adjust))) +(notmuch-show-goto-message current))) (defun notmuch-show-refresh-view (&optional reset-state) "Refresh the current view. -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[Patch v4 0/3] Add filter to emacs show mode
This is version 4 of the patch set allowing the user to "filter" which messages are open in emacs show mode. The previous version was at id:"1335467689-6513-1-git-send-email-markwalters1...@gmail.com" The change in this version is to keep position in the thread (at least to the same message). The first patch (new in this series) just splits out a sub-function notmuch-show-goto-msg-id from notmuch-show-apply-state. The second patch is almost the same as the first patch in the previous series but uses the new notmuch-show-goto-msg-id function to maintain position in the thread. The final patch is identical to the final patch of the previous series which moves the key-binding for filter in emacs search mode to 'l' to match the new binding in show-mode. Best wishes Mark Mark Walters (3): emacs: split notmuch-show-apply-state emacs: add a filter option to show emacs: Bind filter in search to 'l' emacs/notmuch-show.el | 30 +++--- emacs/notmuch.el |4 ++-- 2 files changed, 25 insertions(+), 9 deletions(-) -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [ANN] New awesome vim plug-in using Ruby bindings
Felipe Contreras wrote: > > vim -c ':NotMuchR' > > > > all I get is an error message: > > > > Error detected while processing command line: > > E492: Not an editor command: :NotMuchR > > I don't know if you did anything special to get the normal plug-in to > work. Maybe you are doing 'source ~/.vim/plugin/notmuch.vim' directly > in your .vimrc, if so, you can try to do the same with notmuch vim > ruby. What I have is 'filetype plugin on'. After banging my head against the wall a bit more, I realised what should have been obvious from the beginning: I need to have vim built with ruby support. So after grabbing the vim source and ./configure --enable-rubyinterp I am now happily writing this from notmuch-ruby. As obvious as this should have been, do you think it deserves a short sentence at the top of the == install == section of your README? -- Best, Alex Alex Ghitza -- http://aghitza.org/ Lecturer in Mathematics -- The University of Melbourne -- Australia ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: priorities for 0.13
Quoth David Bremner on Apr 25 at 9:31 am: > > Hi All; > > I'd like to have a feature freeze for 0.13 sometime in the first week of > May. What do people feel are priorities to try to get reviewed and > pushed for 0.13? I've posted the changes to notmuch_database_{open,create} that we've discussed would be nice to go in along with the SO version bump: id:"1335651473-19652-1-git-send-email-amdra...@mit.edu" Just to keep track of things, I also posted a patch to bump the SO version: id:"1335651936-27209-1-git-send-email-amdra...@mit.edu" But feel free to do that however's most convenient. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[ANN] New awesome vim plug-in using Ruby bindings
On Sat, Apr 28, 2012 at 1:40 PM, Alex Ghitza wrote: > vim -c ':NotMuchR' > > all I get is an error message: > > Error detected while processing command line: > E492: Not an editor command: :NotMuchR I don't know if you did anything special to get the normal plug-in to work. Maybe you are doing 'source ~/.vim/plugin/notmuch.vim' directly in your .vimrc, if so, you can try to do the same with notmuch vim ruby. What I have is 'filetype plugin on'. Cheers. -- Felipe Contreras
Re: [Patch v3 0/2] Add filter to emacs show mode
LGTM. It's too bad limiting will loose point, but obviously that can be fixed later. Quoth Mark Walters on Apr 26 at 8:14 pm: > Version 3 of this patch set: previous version is at > id:"1335373954-4578-1-git-send-email-markwalters1...@gmail.com". > > This is updated to use Tomi's much cleaner version for the lisp. > > > Mark Walters (2): > emacs: add a filter option to show > emacs: Bind filter in search to 'l' > > emacs/notmuch-show.el | 10 ++ > emacs/notmuch.el |4 ++-- > 2 files changed, 12 insertions(+), 2 deletions(-) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] lib: Bump SO version from 2.0.0 to 3.0.0
We've changed the APIs of notmuch_database_open, notmuch_database_create, and notmuch_database_close. --- Some of this patch's context comes from id:"1335651473-19652-1-git-send-email-amdra...@mit.edu", so it won't apply cleanly without that. NEWS |3 +++ lib/Makefile.local |2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index 0f031f3..0e8c099 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,9 @@ contrib/ from now on. Library changes --- +The API changes detailed below break binary and source compatibility, +so libnotmuch has been bumped to version 3.0.0. + The function notmuch_database_close has been split into notmuch_database_close and notmuch_database_destroy diff --git a/lib/Makefile.local b/lib/Makefile.local index 54c4dea..8a9aa28 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -5,7 +5,7 @@ # the library interface, (such as the deletion of an API or a major # semantic change that breaks formerly functioning code). # -LIBNOTMUCH_VERSION_MAJOR = 2 +LIBNOTMUCH_VERSION_MAJOR = 3 # The minor version of the library interface. This should be incremented at # the time of release for any additions to the library interface, -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 0/6] Make notmuch_database_{open,create} return status codes
Since we're breaking binary and source compatibility with the next release anyway, it's about time we fix notmuch_database_{open,create} to return status codes. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/6] lib/cli: Make notmuch_database_open return a status code
It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails. --- lib/database.cc | 19 ++- lib/notmuch.h | 12 +--- notmuch-count.c |5 ++--- notmuch-dump.c |5 ++--- notmuch-new.c |5 ++--- notmuch-reply.c |5 ++--- notmuch-restore.c |5 ++--- notmuch-search.c|5 ++--- notmuch-show.c |5 ++--- notmuch-tag.c |5 ++--- test/symbol-test.cc |3 ++- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 2fefcad..a29fe67 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -556,8 +556,9 @@ notmuch_database_create (const char *path) goto DONE; } -notmuch = notmuch_database_open (path, -NOTMUCH_DATABASE_MODE_READ_WRITE); +notmuch_database_open (path, + NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much); notmuch_database_upgrade (notmuch, NULL, NULL); DONE: @@ -578,10 +579,12 @@ _notmuch_database_ensure_writable (notmuch_database_t *notmuch) return NOTMUCH_STATUS_SUCCESS; } -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode) + notmuch_database_mode_t mode, + notmuch_database_t **database) { +notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; void *local = talloc_new (NULL); notmuch_database_t *notmuch = NULL; char *notmuch_path, *xapian_path; @@ -592,6 +595,7 @@ notmuch_database_open (const char *path, if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -599,11 +603,13 @@ notmuch_database_open (const char *path, if (err) { fprintf (stderr, "Error opening database at %s: %s\n", notmuch_path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, "xapian"))) { fprintf (stderr, "Out of memory\n"); + status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } @@ -644,6 +650,7 @@ notmuch_database_open (const char *path, notmuch->mode = NOTMUCH_DATABASE_MODE_READ_ONLY; notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } @@ -704,12 +711,14 @@ notmuch_database_open (const char *path, error.get_msg().c_str()); notmuch_database_destroy (notmuch); notmuch = NULL; + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; } DONE: talloc_free (local); -return notmuch; +*database = notmuch; +return status; } void diff --git a/lib/notmuch.h b/lib/notmuch.h index 7d9e092..8a011f2 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -151,9 +151,6 @@ typedef enum { NOTMUCH_DATABASE_MODE_READ_WRITE } notmuch_database_mode_t; -/* XXX: I think I'd like this to take an extra argument of - * notmuch_status_t* for returning a status value on failure. */ - /* Open an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, @@ -168,12 +165,13 @@ typedef enum { * The caller should call notmuch_database_destroy when finished with * this database. * - * In case of any failure, this function returns NULL, (after printing - * an error message on stderr). + * In case of any failure, this function returns an error status and + * sets *database to NULL (after printing an error message on stderr). */ -notmuch_database_t * +notmuch_status_t notmuch_database_open (const char *path, - notmuch_database_mode_t mode); + notmuch_database_mode_t mode, + notmuch_database_t **database); /* Close the given notmuch database. * diff --git a/notmuch-count.c b/notmuch-count.c index 9c2ad7b..2f98128 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -66,9 +66,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; -notmuch = notmuch_database_open (notmuch_config_get_database_path (config), -NOTMUCH_DATABASE_MODE_READ_ONLY); -if (notmuch == NULL) +if (notmuch_database_open (notmuch_config_get_database_p
[PATCH 3/6] go: Update Go bindings for new notmuch_database_{open, create} signatures
This requires changing the return types of NewDatabase and OpenDatabase to follow the standard Go convention for returning errors. --- bindings/go/pkg/notmuch.go | 24 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index d32901d..86e9645 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -86,21 +86,21 @@ const ( ) // Create a new, empty notmuch database located at 'path' -func NewDatabase(path string) *Database { +func NewDatabase(path string) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_create(c_path) - if self.db == nil { - return nil + st := Status(C.notmuch_database_create(c_path, &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Open an existing notmuch database located at 'path'. @@ -120,21 +120,21 @@ func NewDatabase(path string) *Database { * In case of any failure, this function returns NULL, (after printing * an error message on stderr). */ -func OpenDatabase(path string, mode DatabaseMode) *Database { +func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) { var c_path *C.char = C.CString(path) defer C.free(unsafe.Pointer(c_path)) if c_path == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } self := &Database{db:nil} - self.db = C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode)) - if self.db == nil { - return nil + st := Status(C.notmuch_database_open(c_path, C.notmuch_database_mode_t(mode), &self.db)) + if st != STATUS_SUCCESS { + return nil, st } - return self + return self, st } /* Close the given notmuch database, freeing all associated -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 6/6] News for changes to notmuch_database_{open,create}
--- NEWS | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index a2cd080..0f031f3 100644 --- a/NEWS +++ b/NEWS @@ -76,15 +76,20 @@ contrib/ from now on. Library changes --- -API changes - - The function notmuch_database_close has been split into - notmuch_database_close and notmuch_database_destroy. +The function notmuch_database_close has been split into +notmuch_database_close and notmuch_database_destroy This makes it possible for long running programs to close the xapian database and thus release the lock associated with it without destroying the data structures obtained from it. +notmuch_database_open and notmuch_database_create now return errors + + The type signatures of notmuch_database_open and + notmuch_database_create have changed so that the functions now + return a notmuch_status_t and take an out-argument for returning the + new database object. + Notmuch 0.12 (2012-03-20) = -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/6] lib/cli: Make notmuch_database_create return a status code
This is the notmuch_database_create equivalent of the previous change. In this case, there were places where errors were not being propagated correctly in notmuch_database_create or in calls to it. These have been fixed, using the new status value. --- lib/database.cc | 26 +++--- lib/notmuch.h |8 notmuch-new.c |3 ++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index a29fe67..a3ae504 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -520,9 +520,10 @@ parse_references (void *ctx, } } -notmuch_database_t * -notmuch_database_create (const char *path) +notmuch_status_t +notmuch_database_create (const char *path, notmuch_database_t **database) { +notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; notmuch_database_t *notmuch = NULL; char *notmuch_path = NULL; struct stat st; @@ -530,6 +531,7 @@ notmuch_database_create (const char *path) if (path == NULL) { fprintf (stderr, "Error: Cannot create a database for a NULL path.\n"); + status = NOTMUCH_STATUS_NULL_POINTER; goto DONE; } @@ -537,12 +539,14 @@ notmuch_database_create (const char *path) if (err) { fprintf (stderr, "Error: Cannot create database at %s: %s.\n", path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } if (! S_ISDIR (st.st_mode)) { fprintf (stderr, "Error: Cannot create database at %s: Not a directory.\n", path); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } @@ -553,19 +557,27 @@ notmuch_database_create (const char *path) if (err) { fprintf (stderr, "Error: Cannot create directory %s: %s.\n", notmuch_path, strerror (errno)); + status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; } -notmuch_database_open (path, - NOTMUCH_DATABASE_MODE_READ_WRITE, - ¬much); -notmuch_database_upgrade (notmuch, NULL, NULL); +status = notmuch_database_open (path, + NOTMUCH_DATABASE_MODE_READ_WRITE, + ¬much); +if (status) + goto DONE; +status = notmuch_database_upgrade (notmuch, NULL, NULL); +if (status) { + notmuch_database_close(notmuch); + notmuch = NULL; +} DONE: if (notmuch_path) talloc_free (notmuch_path); -return notmuch; +*database = notmuch; +return status; } notmuch_status_t diff --git a/lib/notmuch.h b/lib/notmuch.h index 8a011f2..d880aeb 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -140,11 +140,11 @@ typedef struct _notmuch_filenames notmuch_filenames_t; * contained within 'path' can be added to the database by calling * notmuch_database_add_message. * - * In case of any failure, this function returns NULL, (after printing - * an error message on stderr). + * In case of any failure, this function returns an error status and + * sets *database to NULL (after printing an error message on stderr). */ -notmuch_database_t * -notmuch_database_create (const char *path); +notmuch_status_t +notmuch_database_create (const char *path, notmuch_database_t **database); typedef enum { NOTMUCH_DATABASE_MODE_READ_ONLY = 0, diff --git a/notmuch-new.c b/notmuch-new.c index 7788743..cb720cc 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -900,7 +900,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) return 1; printf ("Found %d total files (that's not much mail).\n", count); - notmuch = notmuch_database_create (db_path); + if (notmuch_database_create (db_path, ¬much)) + return 1; add_files_state.total_files = count; } else { if (notmuch_database_open (db_path, NOTMUCH_DATABASE_MODE_READ_WRITE, -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 5/6] ruby: Update Ruby bindings for new notmuch_database_{open, create} signatures
--- bindings/ruby/database.c | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index ba9a139..409d54f 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -42,6 +42,8 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) int create, mode; VALUE pathv, hashv; VALUE modev; +notmuch_database_t *database; +notmuch_status_t ret; /* Check arguments */ rb_scan_args (argc, argv, "11", &pathv, &hashv); @@ -73,9 +75,13 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) } Check_Type (self, T_DATA); -DATA_PTR (self) = create ? notmuch_database_create (path) : notmuch_database_open (path, mode); -if (!DATA_PTR (self)) - rb_raise (notmuch_rb_eDatabaseError, "Failed to open database"); +if (create) + ret = notmuch_database_create (path, &database); +else + ret = notmuch_database_open (path, mode, &database); +notmuch_rb_status_raise (ret); + +DATA_PTR (self) = database; return self; } -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 4/6] python: Update Python bindings for new notmuch_database_{open, create} signatures
--- bindings/python/notmuch/database.py | 29 - 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 268e952..adc0a3f 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -95,8 +95,8 @@ class Database(object): """notmuch_database_open""" _open = nmlib.notmuch_database_open -_open.argtypes = [c_char_p, c_uint] -_open.restype = NotmuchDatabaseP +_open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)] +_open.restype = c_uint """notmuch_database_upgrade""" _upgrade = nmlib.notmuch_database_upgrade @@ -122,8 +122,8 @@ class Database(object): """notmuch_database_create""" _create = nmlib.notmuch_database_create -_create.argtypes = [c_char_p] -_create.restype = NotmuchDatabaseP +_create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)] +_create.restype = c_uint def __init__(self, path = None, create = False, mode = MODE.READ_ONLY): @@ -193,12 +193,13 @@ class Database(object): raise NotmuchError(message="Cannot create db, this Database() " "already has an open one.") -res = Database._create(_str(path), Database.MODE.READ_WRITE) +db = NotmuchDatabaseP() +status = Database._create(_str(path), Database.MODE.READ_WRITE, byref(db)) -if not res: -raise NotmuchError( -message="Could not create the specified database") -self._db = res +if status != STATUS.SUCCESS: +raise NotmuchError(status) +self._db = db +return status def open(self, path, mode=0): """Opens an existing database @@ -212,11 +213,13 @@ class Database(object): :raises: Raises :exc:`NotmuchError` in case of any failure (possibly after printing an error message on stderr). """ -res = Database._open(_str(path), mode) +db = NotmuchDatabaseP() +status = Database._open(_str(path), mode, byref(db)) -if not res: -raise NotmuchError(message="Could not open the specified database") -self._db = res +if status != STATUS.SUCCESS: +raise NotmuchError(status) +self._db = db +return status _close = nmlib.notmuch_database_close _close.argtypes = [NotmuchDatabaseP] -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] go: Update to the current notmuch_database_find_message API
The signature of notmuch_database_find_message was changed in 02a30767 to report errors and the Go bindings were never updated. This brings the Go bindings in sync with that change and at least makes them compile with Go r60.3, the last release before Go 1. --- bindings/go/pkg/notmuch.go | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index c6844ef..8fe400b 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -306,20 +306,21 @@ func (self *Database) RemoveMessage(fname string) Status { * * An out-of-memory situation occurs * * A Xapian exception occurs */ -func (self *Database) FindMessage(message_id string) *Message { +func (self *Database) FindMessage(message_id string) (*Message, Status) { var c_msg_id *C.char = C.CString(message_id) defer C.free(unsafe.Pointer(c_msg_id)) if c_msg_id == nil { - return nil + return nil, STATUS_OUT_OF_MEMORY } - msg := C.notmuch_database_find_message(self.db, c_msg_id) - if msg == nil { - return nil + msg := &Message{message:nil} + st := Status(C.notmuch_database_find_message(self.db, c_msg_id, &msg.message)) + if st != STATUS_SUCCESS { + return nil, st } - return &Message{message:msg} + return msg, st } /* Return a list of all tags found in the database. -- 1.7.9.1 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
emacs tagging cleanup, v3
On Sat, Apr 14 2012, Jameson Graef Rollins wrote: > This is a further cleaned up and simplified version of [0]. The scope > is slightly reduced, but we still end up with a simpler user > interface, with the primary tagging functions being: > > notmuch-search-tag > notmuch-show-tag > > In this series only one user facing tagging function, > notmuch-search-tag-thread, is removed, since it is completely > redundant with the now more flexible notmuch-search-tag. This series, consisting: id:"1334429574-12918-2-git-send-email-jrollins at finestructure.net" id:"1334436547-10260-1-git-send-email-jrollins at finestructure.net" id:"1334429574-12918-4-git-send-email-jrollins at finestructure.net" id:"1334429574-12918-5-git-send-email-jrollins at finestructure.net" id:"1334429574-12918-6-git-send-email-jrollins at finestructure.net" looks good to me. > jamie. Tomi > [0] id:"1333845338-22960-1-git-send-email-jrollins at finestructure.net"
[PATCH v4 2/6] config: Check 'config get' arity exactly
Peter Wang writes: > Require that 'config get' is passed exactly one additional argument, > instead of silently ignoring extra arguments. As a side-effect, produce > more specific error messages for the 'config' command as a whole. Hi Peter; I pushed the rest of the series to master. Would you mind making patch to NEWS describing the new feature? thanks d
[PATCH] emacs: Let the user choose where to compose new mails
On Sat, Apr 14 2012, Jameson Graef Rollins wrote: > From: Thomas Jost > > Introduce a new defcustom notmuch-mua-compose-in that allows users to > specify where new mails are composed., either in the current window or > in a new window or frame. > > Signed-off-by: Jameson Rollins > --- > This is a rebase of this original patch against the current master, > with an expanded commit message. +1 Tomi > > emacs/notmuch-mua.el | 42 +++--- > 1 file changed, 39 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 87bd88d..a96ac3d 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -36,6 +36,21 @@ >:group 'notmuch-send >:group 'notmuch-hooks) > > +(defcustom notmuch-mua-compose-in 'current-window > + "Where to create the mail buffer used to compose a new message. > + Possible values are `current-window' (default), `new-window' > + and `new-frame'. If set to `current-window', the mail buffer > + will be displayed in the current window, so the old buffer will > + be restored when the mail buffer is killed. If set to > + `new-window' or `new-frame', the mail buffer will be displayed > + in a new window/frame that will be destroyed when the buffer is > + killed. You may want to customize `message-kill-buffer-on-exit' > + accordingly." > + :group 'notmuch > + :type '(choice (const :tag "Compose in the current window" current-window) > + (const :tag "Compose mail in a new window" new-window) > + (const :tag "Compose mail in a new frame" new-frame))) > + > (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full >"Function used to generate a `User-Agent:' string. If this is > `nil' then no `User-Agent:' will be generated." > @@ -55,6 +70,23 @@ list." > > ;; > > +(defun notmuch-mua-get-switch-function () > + "Get a switch function according to `notmuch-mua-compose-in'." > + (cond ((eq notmuch-mua-compose-in 'current-window) > + 'switch-to-buffer) > + ((eq notmuch-mua-compose-in 'new-window) > + 'switch-to-buffer-other-window) > + ((eq notmuch-mua-compose-in 'new-frame) > + 'switch-to-buffer-other-frame) > + (t (error "Invalid value for `notmuch-mua-compose-in'" > + > +(defun notmuch-mua-maybe-set-window-dedicated () > + "Set the selected window as dedicated according to > +`notmuch-mua-compose-in'." > + (when (or (eq notmuch-mua-compose-in 'new-frame) > + (eq notmuch-mua-compose-in 'new-window)) > +(set-window-dedicated-p (selected-window) t))) > + > (defun notmuch-mua-user-agent-full () >"Generate a `User-Agent:' string suitable for notmuch." >(concat (notmuch-mua-user-agent-notmuch) > @@ -148,7 +180,8 @@ list." >collect pair))) > (notmuch-mua-mail (plist-get reply-headers :To) > (plist-get reply-headers :Subject) > - (notmuch-headers-plist-to-alist reply-headers > + (notmuch-headers-plist-to-alist reply-headers) > + nil (notmuch-mua-get-switch-function > >;; Insert the message body - but put it in front of the signature >;; if one is present > @@ -186,6 +219,7 @@ list." >(set-buffer-modified-p nil)) > > (defun notmuch-mua-forward-message () > + (funcall (notmuch-mua-get-switch-function) (current-buffer)) >(message-forward) > >(when notmuch-mua-user-agent-function > @@ -195,6 +229,7 @@ list." >(message-sort-headers) >(message-hide-headers) >(set-buffer-modified-p nil) > + (notmuch-mua-maybe-set-window-dedicated) > >(message-goto-to)) > > @@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'." >(message-sort-headers) >(message-hide-headers) >(set-buffer-modified-p nil) > + (notmuch-mua-maybe-set-window-dedicated) > >(message-goto-to)) > > @@ -272,8 +308,8 @@ the From: address first." >(interactive "P") >(let ((other-headers >(when (or prompt-for-sender notmuch-always-prompt-for-sender) > -(list (cons 'From (notmuch-mua-prompt-for-sender)) > -(notmuch-mua-mail nil nil other-headers))) > +(list (cons "From" (notmuch-mua-prompt-for-sender)) > +(notmuch-mua-mail nil nil other-headers nil > (notmuch-mua-get-switch-function > > (defun notmuch-mua-new-forward-message (&optional prompt-for-sender) >"Invoke the notmuch message forwarding window. > -- > 1.7.9.5 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/7] Split notmuch_database_close into two functions
Justus Winter <4winter at informatik.uni-hamburg.de> writes: > Formerly notmuch_database_close closed the xapian database and > destroyed the talloc structure associated with the notmuch database > object. Split notmuch_database_close into notmuch_database_close and > notmuch_database_destroy. Series pushed. d
Re: [PATCH v4 2/6] config: Check 'config get' arity exactly
Peter Wang writes: > Require that 'config get' is passed exactly one additional argument, > instead of silently ignoring extra arguments. As a side-effect, produce > more specific error messages for the 'config' command as a whole. Hi Peter; I pushed the rest of the series to master. Would you mind making patch to NEWS describing the new feature? thanks d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 1/7] Split notmuch_database_close into two functions
Justus Winter <4win...@informatik.uni-hamburg.de> writes: > Formerly notmuch_database_close closed the xapian database and > destroyed the talloc structure associated with the notmuch database > object. Split notmuch_database_close into notmuch_database_close and > notmuch_database_destroy. Series pushed. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [ANN] New awesome vim plug-in using Ruby bindings
On Sat, Apr 28, 2012 at 1:40 PM, Alex Ghitza wrote: > vim -c ':NotMuchR' > > all I get is an error message: > > Error detected while processing command line: > E492: Not an editor command: :NotMuchR I don't know if you did anything special to get the normal plug-in to work. Maybe you are doing 'source ~/.vim/plugin/notmuch.vim' directly in your .vimrc, if so, you can try to do the same with notmuch vim ruby. What I have is 'filetype plugin on'. Cheers. -- Felipe Contreras ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [ANN] New awesome vim plug-in using Ruby bindings
Hi Felipe, On Thu, Apr 26, 2012 at 8:29 AM, Felipe Contreras wrote: > In case anybody is interested, here's a screencast showing some of the > features :) > http://youtu.be/JGD7IbZmnIs This looks great, but I can't seem to be able to get it to work on my machine. I have put notmuch-ruby.vim alongside notmuch.vim inside .vim/plugin, and the .vim/syntax/notmuch-* files are there as well. If I do vim -c ':NotMuch' I can get into the normal vim frontend for notmuch, but if I try vim -c ':NotMuchR' all I get is an error message: Error detected while processing command line: E492: Not an editor command: :NotMuchR Sorry about the completely noob question, but I've been unsuccessfully trying to get this to work for a while now and I have run out of ideas. I'm of course happy to provide whatever information would help get to the bottom of this. -- Best, Alex -- Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne http://aghitza.org ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: emacs tagging cleanup, v3
On Sat, Apr 14 2012, Jameson Graef Rollins wrote: > This is a further cleaned up and simplified version of [0]. The scope > is slightly reduced, but we still end up with a simpler user > interface, with the primary tagging functions being: > > notmuch-search-tag > notmuch-show-tag > > In this series only one user facing tagging function, > notmuch-search-tag-thread, is removed, since it is completely > redundant with the now more flexible notmuch-search-tag. This series, consisting: id:"1334429574-12918-2-git-send-email-jroll...@finestructure.net" id:"1334436547-10260-1-git-send-email-jroll...@finestructure.net" id:"1334429574-12918-4-git-send-email-jroll...@finestructure.net" id:"1334429574-12918-5-git-send-email-jroll...@finestructure.net" id:"1334429574-12918-6-git-send-email-jroll...@finestructure.net" looks good to me. > jamie. Tomi > [0] id:"1333845338-22960-1-git-send-email-jroll...@finestructure.net" ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] emacs: Let the user choose where to compose new mails
On Sat, Apr 14 2012, Jameson Graef Rollins wrote: > From: Thomas Jost > > Introduce a new defcustom notmuch-mua-compose-in that allows users to > specify where new mails are composed., either in the current window or > in a new window or frame. > > Signed-off-by: Jameson Rollins > --- > This is a rebase of this original patch against the current master, > with an expanded commit message. +1 Tomi > > emacs/notmuch-mua.el | 42 +++--- > 1 file changed, 39 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 87bd88d..a96ac3d 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -36,6 +36,21 @@ >:group 'notmuch-send >:group 'notmuch-hooks) > > +(defcustom notmuch-mua-compose-in 'current-window > + "Where to create the mail buffer used to compose a new message. > + Possible values are `current-window' (default), `new-window' > + and `new-frame'. If set to `current-window', the mail buffer > + will be displayed in the current window, so the old buffer will > + be restored when the mail buffer is killed. If set to > + `new-window' or `new-frame', the mail buffer will be displayed > + in a new window/frame that will be destroyed when the buffer is > + killed. You may want to customize `message-kill-buffer-on-exit' > + accordingly." > + :group 'notmuch > + :type '(choice (const :tag "Compose in the current window" current-window) > + (const :tag "Compose mail in a new window" new-window) > + (const :tag "Compose mail in a new frame" new-frame))) > + > (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full >"Function used to generate a `User-Agent:' string. If this is > `nil' then no `User-Agent:' will be generated." > @@ -55,6 +70,23 @@ list." > > ;; > > +(defun notmuch-mua-get-switch-function () > + "Get a switch function according to `notmuch-mua-compose-in'." > + (cond ((eq notmuch-mua-compose-in 'current-window) > + 'switch-to-buffer) > + ((eq notmuch-mua-compose-in 'new-window) > + 'switch-to-buffer-other-window) > + ((eq notmuch-mua-compose-in 'new-frame) > + 'switch-to-buffer-other-frame) > + (t (error "Invalid value for `notmuch-mua-compose-in'" > + > +(defun notmuch-mua-maybe-set-window-dedicated () > + "Set the selected window as dedicated according to > +`notmuch-mua-compose-in'." > + (when (or (eq notmuch-mua-compose-in 'new-frame) > + (eq notmuch-mua-compose-in 'new-window)) > +(set-window-dedicated-p (selected-window) t))) > + > (defun notmuch-mua-user-agent-full () >"Generate a `User-Agent:' string suitable for notmuch." >(concat (notmuch-mua-user-agent-notmuch) > @@ -148,7 +180,8 @@ list." >collect pair))) > (notmuch-mua-mail (plist-get reply-headers :To) > (plist-get reply-headers :Subject) > - (notmuch-headers-plist-to-alist reply-headers > + (notmuch-headers-plist-to-alist reply-headers) > + nil (notmuch-mua-get-switch-function > >;; Insert the message body - but put it in front of the signature >;; if one is present > @@ -186,6 +219,7 @@ list." >(set-buffer-modified-p nil)) > > (defun notmuch-mua-forward-message () > + (funcall (notmuch-mua-get-switch-function) (current-buffer)) >(message-forward) > >(when notmuch-mua-user-agent-function > @@ -195,6 +229,7 @@ list." >(message-sort-headers) >(message-hide-headers) >(set-buffer-modified-p nil) > + (notmuch-mua-maybe-set-window-dedicated) > >(message-goto-to)) > > @@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'." >(message-sort-headers) >(message-hide-headers) >(set-buffer-modified-p nil) > + (notmuch-mua-maybe-set-window-dedicated) > >(message-goto-to)) > > @@ -272,8 +308,8 @@ the From: address first." >(interactive "P") >(let ((other-headers >(when (or prompt-for-sender notmuch-always-prompt-for-sender) > -(list (cons 'From (notmuch-mua-prompt-for-sender)) > -(notmuch-mua-mail nil nil other-headers))) > +(list (cons "From" (notmuch-mua-prompt-for-sender)) > +(notmuch-mua-mail nil nil other-headers nil > (notmuch-mua-get-switch-function > > (defun notmuch-mua-new-forward-message (&optional prompt-for-sender) >"Invoke the notmuch message forwarding window. > -- > 1.7.9.5 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch