Re: [PATCH] emacs: Added is:tag style completion to notmuch-read-query.

2015-05-31 Thread David Bremner
David Bremner da...@tethera.net writes:

 From: Charles Celerier ccel...@cs.stanford.edu

 The notmuch-search-terms man page states that tag:tag is equivalent
 to is:tag. Completion for is:tag style searches is now supported
 in the Emacs interface.

 Amended by David Bremner: combine lexical-let and let into
 lexical-let*

Pushed. I had to resolve conflicts by hand, which is why I didn't merge
it for 0.20.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: change setup to set up where used as a verb

2015-05-31 Thread David Bremner
J. Lewis Muir jlm...@imca-cat.org writes:

 The word setup is a noun, not a verb.  Change occurrences of setup
 where used as a verb to set up.

 ---

pushed

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: remove redundant 'file' command from gdb scripts.

2015-05-31 Thread David Bremner
Quoting Debian bug 787341

   It failed to build on arm64: the last ten tests in T070-insert
   failed.

   What's happening here is that GDB is segfaulting in response to
   the
   file command. GDB on arm64 can be a bit buggy.

   However, the file command is redundant here as GDB has already
   got
   the file from the --args on the command line.
---
 test/T070-insert.sh | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 168345c..74f1955 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -191,7 +191,6 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
 READ_ONLY_DATABASE UPGRADE_REQUIRED; do
 gen_insert_msg
 cat EOF  index-file-$code.gdb
-file notmuch
 set breakpoint pending on
 break notmuch_database_add_message
 commands
-- 
2.1.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


bug report: Emacs notmuch-mode fails attachments with spaces

2015-05-31 Thread Nils Dagsson Moskopp
David Edmondson  writes:

> On Tue, Feb 10 2015, Nils Dagsson Moskopp wrote:
>> Tomi Ollila  writes:
>>
>>> On Mon, Feb 09 2015, Nils Dagsson Moskopp >> dieweltistgarnichtso.net> wrote:
>>>
>>>> Dear notmuch developers,
>>>>
>>>>
>>>> I use notmuch-mode for GNU Emacs for managing my email.
>>>>
>>>> I think I have found a bug in notmuch-mode: If I do “.-v” on the line 
>>>> “[
>>>> 2015 _ Richtlinien.pdf: application/pdf ]”, then notmuch will open three
>>>> windows of zathura (the PDF viewer I use).
>>>>
>>>> It seems to me that someone here either forgot quoting or decided to
>>>> split filenames on spaces. I suggest that “2015 _ Richtlinien.pdf:
>>>> application/pdf” should be quoted in notmuch-show-view-part.
>>>>
>>>> Note that saving attachment (“.-s”, notmuch-show-save-part) generally
>>>> works even if the attachment file names have spaces. In case it matters,
>>>> I normally use the rc(1) shell in Debian <http://tobold.org/article/rc>.
>>>
>>> This code handles the saving and displaying in question (quick look hop i
>>> am right :)
>>>
>>>2282 (defun notmuch-show-save-part ()
>>>2283   "Save the MIME part containing point to a file."
>>>2284   (interactive)
>>>2285   (notmuch-show-apply-to-current-part-handle #'mm-save-part))
>>>2286 
>>>2287 (defun notmuch-show-view-part ()
>>>2288   "View the MIME part containing point in an external viewer."
>>>2289   (interactive)
>>>2290   ;; Set mm-inlined-types to nil to force an external viewer
>>>2291   (let ((mm-inlined-types nil))
>>>2292 (notmuch-show-apply-to-current-part-handle #'mm-display-part)))
>>>
>>> SO, there is 2 options:
>>>
>>> 1) mm executes save part correctly but not display part
>>
>> It seems I cannot investigate this with my knowledge, as “M-x
>> find-function RET mm-display-part” gives “Can't find library
>> /usr/share/emacs/23.4/lisp/gnus/mm-decode.el”. Any ideas?
>>
>>> 2) there is (shell) wrapper program executing zathura which cannot handle
>>>arguments with spaces (there is plenty of examples of this!)
>>>
>>>
>>> You could try to check how th external processes are executed by executing:
>>>
>>> strace -f -e trace=process emacs -f notmuch
>>>
>>> (emacs on X is preferable in this case ;)
>>
>> Thank you for that suggestion. It seems that there does happen both some
>> (wrong) escaping and splitting at spaces. I can see the following trace:
>>
>> --- snib ---
>> execve("/usr/bin/zathura", ["/usr/bin/zathura", "/tmp/emm.23178ut2/2015\\", 
>> "_\\", "Richtlinien.pdf"] [/* 51 vars */]) = 0
>> --- snab ---
>>
>> Somewhat unusually, it is preceeded by an invocation of the shell:
>>
>> --- sneb ---
>> execve("/usr/bin/rc", ["/usr/bin/rc", "-c", "/usr/bin/zathura 
>> /tmp/emm.23178u"...], [/* 51 vars */] 
>
> It would be useful to see the rest of this string ^^. Can you persuade
> strace to show more please?

I have no idea how. Do you?

-- 
Nils Dagsson Moskopp // erlehmann
<http://dieweltistgarnichtso.net>
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20150531/d0502569/attachment.sig>


[PATCH] test: remove redundant 'file' command from gdb scripts.

2015-05-31 Thread David Bremner
Quoting Debian bug 787341

   It failed to build on arm64: the last ten tests in T070-insert
   failed.

   What's happening here is that GDB is segfaulting in response to
   the
   "file" command. GDB on arm64 can be a bit buggy.

   However, the "file" command is redundant here as GDB has already
   got
   the file from the --args on the command line.
---
 test/T070-insert.sh | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 168345c..74f1955 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -191,7 +191,6 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
 READ_ONLY_DATABASE UPGRADE_REQUIRED; do
 gen_insert_msg
 cat < index-file-$code.gdb
-file notmuch
 set breakpoint pending on
 break notmuch_database_add_message
 commands
-- 
2.1.4



[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2015-05-31 Thread David Bremner
David Bremner  writes:

> From: Charles Celerier 
>
> The notmuch-search-terms man page states that "tag:" is equivalent
> to "is:". Completion for "is:" style searches is now supported
> in the Emacs interface.
>
> Amended by David Bremner: combine lexical-let and let into
> lexical-let*

Pushed. I had to resolve conflicts by hand, which is why I didn't merge
it for 0.20.

d


[PATCH] cli: change "setup" to "set up" where used as a verb

2015-05-31 Thread David Bremner
"J. Lewis Muir"  writes:

> The word "setup" is a noun, not a verb.  Change occurrences of "setup"
> where used as a verb to "set up".
>
> ---

pushed

d


[PATCH 0/5] Additions to Go bindings

2015-05-31 Thread laochailan
I added bindings for thread lists and thread to the Go bindings and fixed
some wrong constant values.

Before, the comment style was not understood well by the automatic
documentation generator of Go, so I converted the documentation comments
to the // style.

Compare the documentation before:
http://godoc.org/github.com/notmuch/notmuch/bindings/go/src/notmuch#Message.RemoveTag
and after the changes:
http://godoc.org/github.com/laochailan/notmuch/bindings/go/src/notmuch#Message.RemoveTag

laochailan (5):
  Added thread bindings to go bindings
  fixed wrong constant values
  formatted comments for better godoc output
  fixed more wrongly initialized constants
  updated NEWS

 NEWS   |   14 +
 bindings/go/src/notmuch/notmuch.go | 1325 +---
 2 files changed, 775 insertions(+), 564 deletions(-)

-- 
2.4.2



[PATCH 2/5] fixed wrong constant values

2015-05-31 Thread laochailan
before, they were both zero, so getting a read-writeable handle was
impossible.
---
 bindings/go/src/notmuch/notmuch.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/go/src/notmuch/notmuch.go 
b/bindings/go/src/notmuch/notmuch.go
index a0b901f..bffc120 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -86,7 +86,7 @@ type Filenames struct {
 type DatabaseMode C.notmuch_database_mode_t

 const (
-   DATABASE_MODE_READ_ONLY DatabaseMode = 0
+   DATABASE_MODE_READ_ONLY DatabaseMode = iota
DATABASE_MODE_READ_WRITE
 )

-- 
2.4.2



[PATCH 1/5] Added thread bindings to go bindings

2015-05-31 Thread laochailan
---
 bindings/go/src/notmuch/notmuch.go | 262 -
 1 file changed, 260 insertions(+), 2 deletions(-)

diff --git a/bindings/go/src/notmuch/notmuch.go 
b/bindings/go/src/notmuch/notmuch.go
index 0fff1ab..a0b901f 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -534,8 +534,6 @@ func (self *Query) CountMessages() uint {
return uint(C.notmuch_query_count_messages(self.query))
 }

-// TODO: wrap threads and thread
-
 /* Is the given 'threads' iterator pointing at a valid thread.
  *
  * When this function returns TRUE, notmuch_threads_get will return a
@@ -556,6 +554,45 @@ func (self *Threads) Valid() bool {
return true
 }

+/* Get the current thread from 'threads' as a notmuch_thread_t.
+ *
+ * Note: The returned thread belongs to 'threads' and has a lifetime
+ * identical to it (and the query to which it belongs).
+ *
+ * See the documentation of notmuch_query_search_threads for example
+ * code showing how to iterate over a notmuch_threads_t object.
+ *
+ * If an out-of-memory situation occurs, this function will return
+ * NULL.
+ */
+func (self *Threads) Get() *Thread {
+   if self.threads == nil {
+   return nil
+   }
+   thread := C.notmuch_threads_get(self.threads)
+   if thread == nil {
+   return nil
+   }
+   return {thread}
+}
+
+/* Move the 'threads' iterator to the next thread.
+ *
+ * If 'threads' is already pointing at the last thread then the
+ * iterator will be moved to a point just beyond that last thread,
+ * (where notmuch_threads_valid will return FALSE and
+ * notmuch_threads_get will return NULL).
+ *
+ * See the documentation of notmuch_query_search_threads for example
+ * code showing how to iterate over a notmuch_threads_t object.
+ */
+func (self *Threads) MoveToNext() {
+   if self.threads == nil {
+   return
+   }
+   C.notmuch_threads_move_to_next(self.threads)
+}
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
@@ -568,6 +605,227 @@ func (self *Threads) Destroy() {
}
 }

+/**
+ * Get the thread ID of 'thread'.
+ *
+ * The returned string belongs to 'thread' and as such, should not be
+ * modified by the caller and will only be valid for as long as the
+ * thread is valid, (which is until notmuch_thread_destroy or until
+ * the query from which it derived is destroyed).
+ */
+func (self *Thread) GetThreadId() string {
+   if self.thread == nil {
+   return ""
+   }
+   id := C.notmuch_thread_get_thread_id(self.thread)
+   if id == nil {
+   return ""
+   }
+   return C.GoString(id)
+}
+
+/**
+ * Get the total number of messages in 'thread'.
+ *
+ * This count consists of all messages in the database belonging to
+ * this thread. Contrast with notmuch_thread_get_matched_messages() .
+ */
+func (self *Thread) GetTotalMessages() int {
+   if self.thread == nil {
+   return 0
+   }
+   return int(C.notmuch_thread_get_total_messages(self.thread))
+}
+
+/**
+ * Get a notmuch_messages_t iterator for the top-level messages in
+ * 'thread' in oldest-first order.
+ *
+ * This iterator will not necessarily iterate over all of the messages
+ * in the thread. It will only iterate over the messages in the thread
+ * which are not replies to other messages in the thread.
+ *
+ * The returned list will be destroyed when the thread is destroyed.
+ */
+func (self *Thread) GetToplevelMessages() (*Messages, Status) {
+   if self.thread == nil {
+   return nil, STATUS_NULL_POINTER
+   }
+
+   msgs := C.notmuch_thread_get_toplevel_messages(self.thread)
+   if msgs == nil {
+   return nil, STATUS_NULL_POINTER
+   }
+   return {msgs}, STATUS_SUCCESS
+}
+
+/**
+ * Get a notmuch_thread_t iterator for all messages in 'thread' in
+ * oldest-first order.
+ *
+ * The returned list will be destroyed when the thread is destroyed.
+ */
+func (self *Thread) GetMessages() (*Messages, Status) {
+   if self.thread == nil {
+   return nil, STATUS_NULL_POINTER
+   }
+
+   msgs := C.notmuch_thread_get_messages(self.thread)
+   if msgs == nil {
+   return nil, STATUS_NULL_POINTER
+   }
+   return {msgs}, STATUS_SUCCESS
+}
+
+/**
+ * Get the number of messages in 'thread' that matched the search.
+ *
+ * This count includes only the messages in this thread that were
+ * matched by the search from which the thread was created and were
+ * not excluded by any exclude tags passed in with the query (see
+ * notmuch_query_add_tag_exclude). Contrast with
+ * notmuch_thread_get_total_messages() .
+ */
+func (self *Thread) GetMatchedMessages() int {
+   if self.thread == nil {
+   return 0
+   }
+   return int(C.notmuch_thread_get_matched_messages(self.thread))
+}
+
+/**
+ * Get the authors of 'thread' 

[PATCH 5/5] updated NEWS

2015-05-31 Thread laochailan
---
 NEWS | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/NEWS b/NEWS
index eeaf0d4..4434f4e 100644
--- a/NEWS
+++ b/NEWS
@@ -262,6 +262,20 @@ Python Bindings

 Add support for `notmuch_query_add_tag_exclude`

+Go Bindings
+---
+
+Add support for `notmuch_threads_t` and `notmuch_thread_t`
+
+Fixed constant values so they are not all zero anymore.
+
+  Previously, it was impossible to open writable database handles,
+  because DATABASE_MODE_READ_ONLY and DATABASE_MODE_READ_WRITE were
+  both set to zero.
+  The same issue occured with sort modes.
+
+Formatting improvements for Godoc generated documentation
+
 Build System
 

-- 
2.4.2



[PATCH 4/5] fixed more wrongly initialized constants

2015-05-31 Thread laochailan
In Go, '= 0' at the beginning means everything is set to zero.
---
 bindings/go/src/notmuch/notmuch.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bindings/go/src/notmuch/notmuch.go 
b/bindings/go/src/notmuch/notmuch.go
index 741fabf..d664287 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -378,7 +378,7 @@ func (self *Database) CreateQuery(query string) *Query {
 type Sort C.notmuch_sort_t

 const (
-   SORT_OLDEST_FIRST Sort = 0
+   SORT_OLDEST_FIRST Sort = iota
SORT_NEWEST_FIRST
SORT_MESSAGE_ID
SORT_UNSORTED
@@ -985,7 +985,7 @@ func (self *Message) GetFileName() string {
 type Flag C.notmuch_message_flag_t

 const (
-   MESSAGE_FLAG_MATCH Flag = 0
+   MESSAGE_FLAG_MATCH Flag = iota
 )

 // Get a value of a flag for the email corresponding to 'message'.
-- 
2.4.2



[PATCH 3/5] formatted comments for better godoc output

2015-05-31 Thread laochailan
before it looked like this
http://godoc.org/github.com/notmuch/notmuch/bindings/go/src/notmuch#Database.RemoveMessage
---
 bindings/go/src/notmuch/notmuch.go | 1325 +---
 1 file changed, 632 insertions(+), 693 deletions(-)

diff --git a/bindings/go/src/notmuch/notmuch.go 
b/bindings/go/src/notmuch/notmuch.go
index bffc120..741fabf 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -44,8 +44,8 @@ func (self Status) String() string {
return ""
 }

-/* Various opaque data types. For each notmuch__t see the various
- * notmuch_ functions below. */
+// Various opaque data types. For each notmuch__t see the various
+// notmuch_ functions below.

 type Database struct {
db *C.notmuch_database_t
@@ -108,23 +108,22 @@ func NewDatabase(path string) (*Database, Status) {
return self, st
 }

-/* Open an existing notmuch database located at 'path'.
- *
- * The database should have been created at some time in the past,
- * (not necessarily by this process), by calling
- * notmuch_database_create with 'path'. By default the database should be
- * opened for reading only. In order to write to the database you need to
- * pass the NOTMUCH_DATABASE_MODE_READ_WRITE mode.
- *
- * An existing notmuch database can be identified by the presence of a
- * directory named ".notmuch" below 'path'.
- *
- * 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).
- */
+// Open an existing notmuch database located at 'path'.
+//
+// The database should have been created at some time in the past,
+// (not necessarily by this process), by calling
+// notmuch_database_create with 'path'. By default the database should be
+// opened for reading only. In order to write to the database you need to
+// pass the NOTMUCH_DATABASE_MODE_READ_WRITE mode.
+//
+// An existing notmuch database can be identified by the presence of a
+// directory named ".notmuch" below 'path'.
+//
+// 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).
 func OpenDatabase(path string, mode DatabaseMode) (*Database, Status) {

var c_path *C.char = C.CString(path)
@@ -142,14 +141,13 @@ func OpenDatabase(path string, mode DatabaseMode) 
(*Database, Status) {
return self, st
 }

-/* Close the given notmuch database, freeing all associated
- * resources. See notmuch_database_open. */
+// Close the given notmuch database, freeing all associated
+// resources. See notmuch_database_open.
 func (self *Database) Close() Status {
return Status(C.notmuch_database_destroy(self.db))
 }

-/* Return the database path of the given database.
- */
+// Return the database path of the given database.
 func (self *Database) GetPath() string {

/* The return value is a string owned by notmuch so should not be
@@ -162,17 +160,17 @@ func (self *Database) GetPath() string {
return ""
 }

-/* Return the database format version of the given database. */
+// Return the database format version of the given database.
 func (self *Database) GetVersion() uint {
return uint(C.notmuch_database_get_version(self.db))
 }

-/* Does this database need to be upgraded before writing to it?
- *
- * If this function returns TRUE then no functions that modify the
- * database (notmuch_database_add_message, notmuch_message_add_tag,
- * notmuch_directory_set_mtime, etc.) will work unless the function
- * notmuch_database_upgrade is called successfully first. */
+// Does this database need to be upgraded before writing to it?
+//
+// If this function returns TRUE then no functions that modify the
+// database (notmuch_database_add_message, notmuch_message_add_tag,
+// notmuch_directory_set_mtime, etc.) will work unless the function
+// notmuch_database_upgrade is called successfully first.
 func (self *Database) NeedsUpgrade() bool {
do_upgrade := C.notmuch_database_needs_upgrade(self.db)
if do_upgrade == 0 {
@@ -183,14 +181,13 @@ func (self *Database) NeedsUpgrade() bool {

 // TODO: notmuch_database_upgrade

-/* Retrieve a directory object from the database for 'path'.
- *
- * Here, 'path' should be a path relative to the path of 'database'
- * (see notmuch_database_get_path), or else should be an absolute path
- * with initial components that match the path of 'database'.
- *
- * Can return NULL if a Xapian exception occurs.
- */
+// Retrieve a directory object from the database for 'path'.
+//
+// Here, 'path' should be a path relative to the path of 'database'
+// (see notmuch_database_get_path), or else should be an absolute path
+// with initial components that match the path of 'database'.
+//
+// Can return NULL if a Xapian exception occurs.
 func (self *Database)