[PATCH 2/2] ruby: cleanup object_destroy()

2021-07-06 Thread Felipe Contreras
It was assumed the destructor of notmuch_rb_database_type did return a
notmuch_status_t because that's what notmuch_database_close returns, and
that value was checked by notmuch_rb_database_close in order to decide
if to raise an exception.

It turns out notmuch_database_destroy was called instead, so nothing was
returned (void).

All the destroy functions are void, and that's what we want.

Signed-off-by: Felipe Contreras 
---
 bindings/ruby/defs.h | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index daac13ab..b3f0621c 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -105,19 +105,16 @@ extern const rb_data_type_t notmuch_rb_tags_type;
 #define Data_Get_Notmuch_Tags(obj, ptr) \
 Data_Get_Notmuch_Object ((obj), _rb_tags_type, (ptr))
 
-static inline notmuch_status_t
+static inline void
 notmuch_rb_object_destroy (VALUE rb_object, const rb_data_type_t *type)
 {
 void *nm_object;
-notmuch_status_t ret;
 
 Data_Get_Notmuch_Object (rb_object, type, nm_object);
 
 /* Call the corresponding notmuch_*_destroy function */
-ret = ((notmuch_status_t (*)(void *)) type->data) (nm_object);
+((void (*)(void *)) type->data) (nm_object);
 DATA_PTR (rb_object) = NULL;
-
-return ret;
 }
 
 /* status.c */
-- 
2.32.0.36.g70aac2b1aa
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/2] ruby: split database close and destroy

2021-07-06 Thread Felipe Contreras
Mirrors the C API: 7864350c (Split notmuch_database_close into two
functions, 2012-04-25).

Signed-off-by: Felipe Contreras 
---
 bindings/ruby/database.c | 19 ++-
 bindings/ruby/defs.h |  3 +++
 bindings/ruby/init.c |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index d6c804ac..1828dc91 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -26,6 +26,19 @@ notmuch_rb_database_alloc (VALUE klass)
 return Data_Wrap_Notmuch_Object (klass, _rb_database_type, NULL);
 }
 
+/*
+ * call-seq: DB.destroy => nil
+ *
+ * Destroys the database, freeing all resources allocated for it.
+ */
+VALUE
+notmuch_rb_database_destroy (VALUE self)
+{
+notmuch_rb_object_destroy (self, _rb_database_type);
+
+return Qnil;
+}
+
 /*
  * call-seq: Notmuch::Database.new(path [, {:create => false, :mode => 
Notmuch::MODE_READ_ONLY}]) => DB
  *
@@ -113,8 +126,12 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE 
klass)
 VALUE
 notmuch_rb_database_close (VALUE self)
 {
+notmuch_database_t *db;
 notmuch_status_t ret;
-ret = notmuch_rb_object_destroy (self, _rb_database_type);
+
+Data_Get_Notmuch_Database (self, db);
+
+ret = notmuch_database_close (db);
 notmuch_rb_status_raise (ret);
 
 return Qnil;
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 995bcafd..daac13ab 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -128,6 +128,9 @@ notmuch_rb_status_raise (notmuch_status_t status);
 VALUE
 notmuch_rb_database_alloc (VALUE klass);
 
+VALUE
+notmuch_rb_database_destroy (VALUE self);
+
 VALUE
 notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE klass);
 
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index d421c601..87f99040 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -260,6 +260,7 @@ Init_notmuch (void)
 rb_define_alloc_func (notmuch_rb_cDatabase, notmuch_rb_database_alloc);
 rb_define_singleton_method (notmuch_rb_cDatabase, "open", 
notmuch_rb_database_open, -1); /* in database.c */
 rb_define_method (notmuch_rb_cDatabase, "initialize", 
notmuch_rb_database_initialize, -1); /* in database.c */
+rb_define_method (notmuch_rb_cDatabase, "destroy!", 
notmuch_rb_database_destroy, 0); /* in database.c */
 rb_define_method (notmuch_rb_cDatabase, "close", 
notmuch_rb_database_close, 0); /* in database.c */
 rb_define_method (notmuch_rb_cDatabase, "path", notmuch_rb_database_path, 
0); /* in database.c */
 rb_define_method (notmuch_rb_cDatabase, "version", 
notmuch_rb_database_version, 0); /* in database.c */
-- 
2.32.0.36.g70aac2b1aa
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 0/2] ruby: sync database close/destroy

2021-07-06 Thread Felipe Contreras
Sychronize with notmuch API, where notmuch_database_close is different
from notmuch_database_destroy. At least since a long time ago.

Felipe Contreras (2):
  ruby: split database close and destroy
  ruby: cleanup object_destroy()

 bindings/ruby/database.c | 19 ++-
 bindings/ruby/defs.h | 10 +-
 bindings/ruby/init.c |  1 +
 3 files changed, 24 insertions(+), 6 deletions(-)

-- 
2.32.0.36.g70aac2b1aa
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: remove useless lexically bound variable

2021-07-06 Thread David Bremner
A let binding without a value is just an obfuscated way of saying
nil, especially if you are not going to mutate the variable.
---
 emacs/notmuch-tree.el | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index b288c05d..eb7ea941 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1001,10 +1001,9 @@ message together with all its descendents."
 
 (defun notmuch-tree-insert-forest-thread (forest-thread)
   "Insert a single complete thread."
-  (let (tree-status)
-;; Reset at the start of each main thread.
-(setq notmuch-tree-previous-subject nil)
-(notmuch-tree-insert-thread forest-thread 0 tree-status)))
+  ;; Reset at the start of each main thread.
+  (setq notmuch-tree-previous-subject nil)
+  (notmuch-tree-insert-thread forest-thread 0 nil))
 
 (defun notmuch-tree-insert-forest (forest)
   "Insert a forest of threads.
-- 
2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: update declaration of notmuch-tree

2021-07-06 Thread David Bremner
This fixes an a warning from the byte-compiler.  The commit
74ab62a34018b38a40db4d363fff3faae964b47a changed the function
signature but did not update the declaration.
---
 emacs/notmuch-hello.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 5e1ff5fe..1e66555b 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -33,7 +33,7 @@
 (declare-function notmuch-poll "notmuch-lib" ())
 (declare-function notmuch-tree "notmuch-tree"
  ( query query-context target buffer-name
-open-target unthreaded parent-buffer))
+open-target unthreaded parent-buffer oldest-first))
 (declare-function notmuch-unthreaded "notmuch-tree"
  ( query query-context target buffer-name
 open-target))
-- 
2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] emacs: fix typo in variable name

2021-07-06 Thread David Bremner
This error crept in during my style rewrite of dkg's proposed change.
---
 emacs/notmuch-crypto.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 5edfe94c..de4d9aea 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -125,7 +125,7 @@ mode."
(setq label (concat "Good signature by key: " fingerprint))
(setq face 'notmuch-crypto-signature-good-key)
(when email-or-userid
- (setq label (concat "Good signature by: " email-or-user-id))
+ (setq label (concat "Good signature by: " email-or-userid))
  (setq face 'notmuch-crypto-signature-good))
(setq button-action 'notmuch-crypto-sigstatus-good-callback)
(setq help-msg (concat "Click to list key ID 0x" fingerprint "."
-- 
2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] replace references to freenode with references to libera

2021-07-06 Thread David Bremner
I left the reference to freenode in the test suite data, since it is
historical.
---
 .travis.yml  | 2 +-
 README   | 2 +-
 doc/man1/notmuch.rst | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9dcec1ff..5bb03de6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,5 +25,5 @@ script:
 notifications:
   irc:
 channels:
-  - "chat.freenode.net#notmuch"
+  - "irc.libera.chat#notmuch"
 on_success: change
diff --git a/README b/README
index 0aa9a080..03bbb57f 100644
--- a/README
+++ b/README
@@ -73,5 +73,5 @@ information.
 There is also an IRC channel dedicated to talk about using and
 developing notmuch:
 
-   IRC server: irc.freenode.net
+   IRC server: irc.libera.chat
Channel:#notmuch
diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst
index e7adcfcd..6bd1dc03 100644
--- a/doc/man1/notmuch.rst
+++ b/doc/man1/notmuch.rst
@@ -210,4 +210,4 @@ list  . Subscription is not 
required before
 posting, but is available from the notmuchmail.org website.
 
 Real-time interaction with the Notmuch community is available via IRC
-(server: irc.freenode.net, channel: #notmuch).
+(server: irc.libera.chat, channel: #notmuch).
-- 
2.30.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: WIP fixes for rfc822/attachement display

2021-07-06 Thread David Bremner
David Bremner  writes:

> This is not finished/correct yet, but maybe it will save someone else
> some debugging.
>
> [PATCH 2/3] emacs: don't inline message/rfc822 parts without content
>

I have confirmed that thanks to larsi's quick fix, patch 2/3 alone makes
things copacetic in emacs master. I have marked the other two patches as
obsolete, although if people thing this case is important enough, we
could try to work around the issues with pre-28 emacs in a more
careful way.

Antoine, is this a common annoyance for you, or a rare issue?

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug#49380: 27.1; is mm-inline-message supported outside Gnus?

2021-07-06 Thread Lars Ingebrigtsen
David Bremner  writes:

> That makes sense to me, with the (perhaps obvious) caveat that calling
> without binding the setup function should cleanly do the display
> (perhaps with less fontification) and return.

Yup.  I've now done the refactoring, so there should be no user-visible
changes for Gnus usage, and it should basically work outside of Gnus, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: bug#49380: 27.1; is mm-inline-message supported outside Gnus?

2021-07-06 Thread David Bremner
Lars Ingebrigtsen  writes:

> But perhaps the function should be rewritten to call a (say)
> `mm-inline-message-setup-function', bound by the caller?  Then both Gnus
> and notmuch could use the function.

That makes sense to me, with the (perhaps obvious) caveat that calling
without binding the setup function should cleanly do the display
(perhaps with less fontification) and return.

Cheers,

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org