Re: [PATCH v2 0/2] ruby: improve db.query
On Sun, May 23, 2021 at 9:19 PM Felipe Contreras wrote: > > I find it a bit annoying to have to modify the query object to add > options when Notmuch::Database.query() can do that just fine. > > This series also adds a mapping to the notmuch_exclude_t enum in order > to be able to specify NOTMUCH_EXCLUDE_ALL and others. > > Nothing changed from v1 except rebased on master of May 23. Any update? -- Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH 2/3] ruby: add db.config
On Thu, Jun 3, 2021 at 10:29 PM Felipe Contreras wrote: > --- a/test/T395-ruby.sh > +++ b/test/T395-ruby.sh > @@ -88,4 +88,11 @@ test_ruby < puts Notmuch::Database.open_with_config.path > EOF > > +test_begin_subtest "config" > +notmuch config list | grep -v '^built_with\.' > EXPECTED > +test_ruby <<"EOF" > +config_db = Notmuch::Database.open_with_config > +config_db.config { |e| puts '%s=%s' % e } > +EOF > + I just noticed this might a little more idiomatic: Notmuch::Database.open_with_config do |db| db.config { |e| puts '%s=%s' % e } end -- Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 3/3] ruby: make db.config return an enumerator
Currently db.config requires a block to work: db.config { |k, v| puts '%s=%s' % [k, v] } If you try to use it without a block you, get an error like: in `config': no block given (LocalJumpError) In Ruby most methods should return an Enumerator if no block is given, like: (1..10).each => # This allows us to do: db.config.to_a db.config.to_h db.config.each { |k, v| ... } And of course what is already possible: db.config { |k, v| ... } Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index 934cbfe8..9316b32d 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -494,6 +494,8 @@ notmuch_rb_database_config (int argc, VALUE *argv, VALUE self) notmuch_config_pairs_t *list; const char *cprefix; +RETURN_ENUMERATOR(self, argc, argv); + Data_Get_Notmuch_Database (self, db); rb_scan_args (argc, argv, "01", &prefix); -- 2.32.0.rc2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 2/3] ruby: add db.config
In order to use notmuch_config_get_pairs. Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 31 +++ bindings/ruby/defs.h | 4 bindings/ruby/init.c | 1 + test/T395-ruby.sh| 7 +++ 4 files changed, 43 insertions(+) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index bc0c22cb..934cbfe8 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -479,3 +479,34 @@ notmuch_rb_database_query_create (VALUE self, VALUE qstrv) return Data_Wrap_Notmuch_Object (notmuch_rb_cQuery, ¬much_rb_query_type, query); } + +/* + * call-seq: DB.config(prefix) {|key, value| block} => nil + * + * Calls +block+ once for each key/value pair. + * + */ +VALUE +notmuch_rb_database_config (int argc, VALUE *argv, VALUE self) +{ +VALUE prefix; +notmuch_database_t *db; +notmuch_config_pairs_t *list; +const char *cprefix; + +Data_Get_Notmuch_Database (self, db); + +rb_scan_args (argc, argv, "01", &prefix); + +cprefix = prefix != Qnil ? RSTRING_PTR (prefix) : ""; + +list = notmuch_config_get_pairs (db, cprefix); +for (; notmuch_config_pairs_valid (list); notmuch_config_pairs_move_to_next (list)) { + const char *key = notmuch_config_pairs_key (list); + const char *value = notmuch_config_pairs_value (list); + rb_yield (rb_ary_new3(2, nm_str_new (key), nm_str_new (value))); +} +notmuch_config_pairs_destroy (list); + +return Qnil; +} diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index 78239229..f31e563b 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -57,6 +57,7 @@ extern ID ID_db_mode; /* Simple string helpers */ #define nm_str(str) (str != Qnil ? RSTRING_PTR (str) : NULL) +#define nm_str_new(str) (str ? rb_str_new_cstr (str) : Qnil) extern const rb_data_type_t notmuch_rb_object_type; extern const rb_data_type_t notmuch_rb_database_type; @@ -182,6 +183,9 @@ notmuch_rb_database_get_all_tags (VALUE self); VALUE notmuch_rb_database_query_create (VALUE self, VALUE qstrv); +VALUE +notmuch_rb_database_config (int argc, VALUE *argv, VALUE self); + /* directory.c */ VALUE notmuch_rb_directory_destroy (VALUE self); diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index 27c7eba3..4b2f8655 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -277,6 +277,7 @@ Init_notmuch (void) notmuch_rb_database_find_message_by_filename, 1); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, 1); /* in database.c */ +rb_define_method (notmuch_rb_cDatabase, "config", notmuch_rb_database_config, -1); /* in database.c */ /* * Document-class: Notmuch::Directory diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh index 27ac4cc8..a7b09589 100755 --- a/test/T395-ruby.sh +++ b/test/T395-ruby.sh @@ -88,4 +88,11 @@ test_ruby < EXPECTED +test_ruby <<"EOF" +config_db = Notmuch::Database.open_with_config +config_db.config { |e| puts '%s=%s' % e } +EOF + test_done -- 2.32.0.rc2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 1/3] ruby: add new Database.open_with_config
In order to make use of notmuch_database_open_with_config. Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 62 bindings/ruby/defs.h | 6 bindings/ruby/init.c | 1 + test/T395-ruby.sh| 6 4 files changed, 75 insertions(+) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index bb993d86..bc0c22cb 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -105,6 +105,68 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass) return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj); } +/* + * call-seq: Notmuch::Database.open_with_config([database_path:, mode:, config_path:, profile:]) [{|db| ... }] + * + * Opens a database with a configuration file. + * + */ +VALUE +notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass) +{ +VALUE obj; +notmuch_database_t *db; +notmuch_status_t ret; +VALUE opts; +const char *database_path = NULL; +notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY; +const char *config_path = NULL; +const char *profile = NULL; + +rb_scan_args (argc, argv, ":", &opts); + +if (!NIL_P (opts)) { + VALUE rdatabase_path, rmode, rconfig_path, rprofile; + VALUE kwargs[4]; + static ID keyword_ids[4]; + + if (!keyword_ids[0]) { + keyword_ids[0] = rb_intern_const ("database_path"); + keyword_ids[1] = rb_intern_const ("mode"); + keyword_ids[2] = rb_intern_const ("config_path"); + keyword_ids[3] = rb_intern_const ("profile"); + } + + rb_get_kwargs (opts, keyword_ids, 0, 4, kwargs); + + rdatabase_path = kwargs[0]; + rmode = kwargs[1]; + rconfig_path = kwargs[2]; + rprofile = kwargs[3]; + + if (rdatabase_path != Qundef) + database_path = nm_str (rdatabase_path); + if (rmode != Qundef) + mode = FIX2INT (rmode); + if (rconfig_path != Qundef) + config_path = nm_str (rconfig_path); + if (rprofile != Qundef) + profile = nm_str (rprofile); +} + +ret = notmuch_database_open_with_config (database_path, mode, +config_path, profile, &db, +NULL); +notmuch_rb_status_raise (ret); +obj = notmuch_rb_database_alloc (klass); +DATA_PTR (obj) = db; + +if (!rb_block_given_p ()) + return obj; + +return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj); +} + /* * call-seq: DB.close => nil * diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index 9860ee17..78239229 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -55,6 +55,9 @@ extern ID ID_db_mode; # define RSTRING_PTR(v) (RSTRING((v))->ptr) #endif /* !defined (RSTRING_PTR) */ +/* Simple string helpers */ +#define nm_str(str) (str != Qnil ? RSTRING_PTR (str) : NULL) + extern const rb_data_type_t notmuch_rb_object_type; extern const rb_data_type_t notmuch_rb_database_type; extern const rb_data_type_t notmuch_rb_directory_type; @@ -134,6 +137,9 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE klass); VALUE notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass); +VALUE +notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass); + VALUE notmuch_rb_database_close (VALUE self); diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index bedfbf60..27c7eba3 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -259,6 +259,7 @@ Init_notmuch (void) notmuch_rb_cDatabase = rb_define_class_under (mod, "Database", rb_cObject); 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_singleton_method (notmuch_rb_cDatabase, "open_with_config", notmuch_rb_database_open_with_config, -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, "close", notmuch_rb_database_close, 0); /* in database.c */ rb_define_method (notmuch_rb_cDatabase, "path", notmuch_rb_database_path, 0); /* in database.c */ diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh index d36d4aff..27ac4cc8 100755 --- a/test/T395-ruby.sh +++ b/test/T395-ruby.sh @@ -82,4 +82,10 @@ q.search_threads.each do |t| end EOF +test_begin_subtest "open with config" +echo "$MAIL_DIR" > EXPECTED +test_ruby <
[PATCH 0/3] ruby: add latest config API
Currently the simplest way to open the notmuch database properly a client must do: $config = IO.popen(%w[notmuch config list]) do |io| io.each(chomp: true).map { |e| e.split('=') }.to_h end $db_name = config['database.path'] $db = Notmuch::Database.new($db_name) While this works and it's not too overly complicated, the notmuch API already has much better constucts. This patch series allows the user to simply do: $db = Notmuch::Database.open_with_config $config = $db.config.to_h And much more. Felipe Contreras (3): ruby: add new Database.open_with_config ruby: add db.config ruby: make db.config return an enumerator bindings/ruby/database.c | 95 bindings/ruby/defs.h | 10 + bindings/ruby/init.c | 2 + test/T395-ruby.sh| 13 ++ 4 files changed, 120 insertions(+) -- 2.32.0.rc2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: PATCH [1/2] mail user agent
On Thu, Jun 03 2021, Tory S. Anderson wrote: > Nice follow-upabout what other browsers do! > > David Bremner writes: > >> Tomi Ollila writes: >> >>> On Mon, May 31 2021, David Bremner wrote: >>> Tomi Ollila writes: > > I am for 'ripping the bandage off' and not configure mail-user-agent > outside of notmuch use (and just require 'notmuch would not set > anything...) > > Could we have some 'compose-mail' variant (different name, of course; > I had one in mind but then came off-by one problem... >;) which > configures mail-user-agent just for that use (or something). > Are you thinking about notmuch-mua-mail (which exists)? Tory, did you try the eval-after-load trick I mentioned btw? That seemed to work in my testing, and I'm just not sure that customizing a notmuch-* variable is much less annoying than adding an eval-after-load to reset the variable after notmuch messes with it. > > No, I'm guilty here. I used my patch instead and haven't looked back > since. I think having to add code lines to an init file is much more > annoying (and less transparent) than simply having something for which I > can add a =:custom= line in my use-package statements, or new users just > use the customizer to explore to. Maybe that's just me, but I feel much > more comfortable about sharing that config or that suggestion with > others, too. Explorability is what customizer's big benefit to emacs is, > so it seems to me a real advantage to have this in there. > mail-user-agent is defcustom in simple.el, starting: (defcustom mail-user-agent 'message-user-agent "Your preference for a mail composition package. Various Emacs Lisp packages (e.g. Reporter) require you to compose an outgoing email message. This variable lets you specify which mail-sending package you prefer. Valid values include: `message-user-agent' -- use the Message package. See Info node `(message)'. `sendmail-user-agent' -- use the Mail package. See Info node `(emacs)Sending Mail'. `mh-e-user-agent' -- use the Emacs interface to the MH mail system. See Info node `(mh-e)'. `gnus-user-agent' -- like `message-user-agent', but with Gnus paraphernalia if Gnus is running, particularly the Gcc: header for archiving. Additional valid symbols may be available; check with the author of your package for details. The function should return non-nil if it succeeds. ... Currently if one uses/used customizer to change to something else, which is saved to .emacs (or somewhere else where custom-file points to), and then loads notmuch, it suddenly changes to 'notmuch-user-agent. AFAIU the change your patch did does not change that, one just has to customize notmuch-mail-user-agent. IMO that makes things messy. If there were option to somehow magically add more values to the mail-user-agent customize menu while loading notmuch.el then one could just directly choose notmuch-user-agent from that menu. Otherwise I don't see other options than document how to do that configuration (and drop that setq and add NEWS entry). Tomi Still waiting for feedback from notmuch users that actually use M-x compose-mail or other similar generic entry points. >>> >>> Does anyone know how compose-mail behaves when one has loaded any other >>> emacs mua (mh, vm, gnus, mu, ...) ? >>> >> >> As far as I can tell >> >>vm: only locally binds mail-user-agent >>mh-e: used to have a setq mail-user-agent, removed in 2003-ish >>mu4e: documents how to set mail-user-agent >>rmail: reads mail-user-agent, but does not set >>gnus: only locally binds mail-user-agent >>wanderlust: tells you how how to set mail-user-agent (and oddly, how >>to define conditionaly define a user agent) >> >> So I think notmuch is the odd one out here. >> ___ >> notmuch mailing list -- notmuch@notmuchmail.org >> To unsubscribe send an email to notmuch-le...@notmuchmail.org > ___ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-le...@notmuchmail.org ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: PATCH [1/2] mail user agent
Nice follow-upabout what other browsers do! David Bremner writes: > Tomi Ollila writes: > >> On Mon, May 31 2021, David Bremner wrote: >> >>> Tomi Ollila writes: I am for 'ripping the bandage off' and not configure mail-user-agent outside of notmuch use (and just require 'notmuch would not set anything...) Could we have some 'compose-mail' variant (different name, of course; I had one in mind but then came off-by one problem... >;) which configures mail-user-agent just for that use (or something). >>> >>> Are you thinking about notmuch-mua-mail (which exists)? >>> >>> Tory, did you try the eval-after-load trick I mentioned btw? That seemed >>> to work in my testing, and I'm just not sure that customizing a >>> notmuch-* variable is much less annoying than adding an eval-after-load to >>> reset the variable after notmuch messes with it. No, I'm guilty here. I used my patch instead and haven't looked back since. I think having to add code lines to an init file is much more annoying (and less transparent) than simply having something for which I can add a =:custom= line in my use-package statements, or new users just use the customizer to explore to. Maybe that's just me, but I feel much more comfortable about sharing that config or that suggestion with others, too. Explorability is what customizer's big benefit to emacs is, so it seems to me a real advantage to have this in there. >>> >>> Still waiting for feedback from notmuch users that actually use M-x >>> compose-mail or other similar generic entry points. >> >> Does anyone know how compose-mail behaves when one has loaded any other >> emacs mua (mh, vm, gnus, mu, ...) ? >> > > As far as I can tell > >vm: only locally binds mail-user-agent >mh-e: used to have a setq mail-user-agent, removed in 2003-ish >mu4e: documents how to set mail-user-agent >rmail: reads mail-user-agent, but does not set >gnus: only locally binds mail-user-agent >wanderlust: tells you how how to set mail-user-agent (and oddly, how >to define conditionaly define a user agent) > > So I think notmuch is the odd one out here. > ___ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-le...@notmuchmail.org ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v2] test: source $NOTMUCH_SRCDIR/test/test-lib-emacs.sh
Tomi Ollila writes: > Sourcing test-lib.sh will cd to TMP_DIRECTORY, so > relative path in $0 will not work in previous version > . $(dirname "$0")/test-lib-emacs.sh > > Now individual test scripts -- e.g. ./test/T310-emacs.sh > will work. Applied to master. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: PATCH [1/2] mail user agent
Tomi Ollila writes: > On Mon, May 31 2021, David Bremner wrote: > >> Tomi Ollila writes: >>> >>> I am for 'ripping the bandage off' and not configure mail-user-agent >>> outside of notmuch use (and just require 'notmuch would not set anything...) >>> >>> Could we have some 'compose-mail' variant (different name, of course; >>> I had one in mind but then came off-by one problem... >;) which >>> configures mail-user-agent just for that use (or something). >>> >> >> Are you thinking about notmuch-mua-mail (which exists)? >> >> Tory, did you try the eval-after-load trick I mentioned btw? That seemed >> to work in my testing, and I'm just not sure that customizing a >> notmuch-* variable is much less annoying than adding an eval-after-load to >> reset the variable after notmuch messes with it. >> >> Still waiting for feedback from notmuch users that actually use M-x >> compose-mail or other similar generic entry points. > > Does anyone know how compose-mail behaves when one has loaded any other > emacs mua (mh, vm, gnus, mu, ...) ? > As far as I can tell vm: only locally binds mail-user-agent mh-e: used to have a setq mail-user-agent, removed in 2003-ish mu4e: documents how to set mail-user-agent rmail: reads mail-user-agent, but does not set gnus: only locally binds mail-user-agent wanderlust: tells you how how to set mail-user-agent (and oddly, how to define conditionaly define a user agent) So I think notmuch is the odd one out here. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 3/3] emacs/tree use notmuch-show-single-message
This is more efficient that notmuch-show-only-matching-messages, since we do not parse the potentially large thread structure to find a single message. This is only a partial fix for notmuch-tree view, because displaying the thread structure in the tree-mode window still crashes on long threads. It is however enough to make unthreaded view handle long threads. --- emacs/notmuch-tree.el | 6 -- test/T465-emacs-unthreaded.sh | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 13007a13..605c0593 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -574,7 +574,7 @@ NOT change the database." (with-selected-window notmuch-tree-message-window (let (;; Since we are only displaying one message do not indent. (notmuch-show-indent-messages-width 0) - (notmuch-show-only-matching-messages t) + (notmuch-show-single-message t) ;; Ensure that `pop-to-buffer-same-window' uses the ;; window we want it to use. (display-buffer-overriding-action @@ -598,7 +598,9 @@ NOT change the database." (when id ;; We close the window to kill off un-needed buffers. (notmuch-tree-close-message-window) - (notmuch-show id + ;; n-s-s-m is buffer local, so use inner let. + (let ((notmuch-show-single-message t)) + (notmuch-show id) (defun notmuch-tree-show-message (arg) "Show the current message. diff --git a/test/T465-emacs-unthreaded.sh b/test/T465-emacs-unthreaded.sh index f9abcebd..0dc52f3a 100755 --- a/test/T465-emacs-unthreaded.sh +++ b/test/T465-emacs-unthreaded.sh @@ -28,7 +28,6 @@ test_emacs '(let ((max-lisp-eval-depth 10)) test_expect_equal_file EXPECTED.unthreaded OUTPUT test_begin_subtest "message from large thread (status)" -test_subtest_known_broken output=$(test_emacs '(let ((max-lisp-eval-depth 10)) (notmuch-unthreaded "subject:large-thread") (notmuch-test-wait) -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 2/3] emacs/show: add parameter notmuch-show-single-message
This dynamically bound variable can be set when the caller of notmuch-show guarantees that exactly one message will match the query. It avoids transporting and parsing the complete thread structure. --- emacs/notmuch-show.el | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ba93febb..9dca5d7e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -178,6 +178,8 @@ indentation." (defvar-local notmuch-show-indent-content t) +(defvar-local notmuch-show-single-message nil) + (defvar notmuch-show-attachment-debug nil "If t log stdout and stderr from attachment handlers. @@ -1314,9 +1316,9 @@ Apply the previously saved STATE if supplied, otherwise show the first relevant message. If no messages match the query return NIL." - (let* ((cli-args (cons "--exclude=false" -(and notmuch-show-elide-non-matching-messages - (list "--entire-thread=false" + (let* ((cli-args (list "--exclude=false")) +(cli-args (if notmuch-show-elide-non-matching-messages (cons "--entire-thread=false" cli-args) cli-args)) +(cli-args (if notmuch-show-single-message (cons "--part=0" cli-args) cli-args)) (queries (notmuch-show--build-queries notmuch-show-thread-id notmuch-show-query-context)) (forest nil) @@ -1327,6 +1329,8 @@ If no messages match the query return NIL." (while (and (not forest) queries) (setq forest (notmuch-query-get-threads (append cli-args (list "'") (car queries) (list "'" + (when (and forest notmuch-show-single-message) + (setq forest (list (list (list forest) (setq queries (cdr queries))) (when forest (notmuch-show-insert-forest forest) -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Handle long threads in unthreaded-view
This obsolete the series starting at id:20210602233108.855449-1-da...@tethera.net Alan reported that this fix worked for him in tree-mode, which is great. In my tests, there is actually an uncaught exception that makes me think the tree / subject window is not quite working in tree-mode, but according to my tests (included in the new series), it _is_ working in unthreaded view. The other change since the initial series is that both invocations of notmuch-show are now wrapped in a let-binding of notmuch-show-single-message. >From an API point of view, the thing we have to decide is if we are going to support notmuch-show-single-message for the forseeable future, or if we should namespace it to indicate it is internal. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 1/3] test: start test file for emacs unthreaded view.
Initial focus is on behaviour with large threads. The second test replicates a bug reported by Alan Schmitt in id:87lf7sojbq@m4x.org. --- test/T465-emacs-unthreaded.sh | 40 +++ 1 file changed, 40 insertions(+) create mode 100755 test/T465-emacs-unthreaded.sh diff --git a/test/T465-emacs-unthreaded.sh b/test/T465-emacs-unthreaded.sh new file mode 100755 index ..f9abcebd --- /dev/null +++ b/test/T465-emacs-unthreaded.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +test_description="emacs unthreaded interface" +. $(dirname "$0")/test-lib.sh || exit 1 +. $(dirname "$0")/test-lib-emacs.sh || exit 1 + +test_require_emacs + +generate_message "[id]=large-thread-1" '[subject]="large thread"' +printf " 2001-01-05 Notmuch Test Suite large thread (inbox unread)\n" \ + >> EXPECTED.unthreaded + +for num in $(seq 2 64); do +prev=$((num - 1)) +generate_message '[subject]="large thread"' "[id]=large-thread-$num" "[in-reply-to]=\" +printf " 2001-01-05 Notmuch Test Suite large thread (inbox unread)\n" \ + >> EXPECTED.unthreaded +done +printf "End of search results.\n" >> EXPECTED.unthreaded + +notmuch new > new.output 2>&1 + +test_begin_subtest "large thread" +test_emacs '(let ((max-lisp-eval-depth 10)) + (notmuch-unthreaded "subject:large-thread") + (notmuch-test-wait) + (test-output))' +test_expect_equal_file EXPECTED.unthreaded OUTPUT + +test_begin_subtest "message from large thread (status)" +test_subtest_known_broken +output=$(test_emacs '(let ((max-lisp-eval-depth 10)) + (notmuch-unthreaded "subject:large-thread") + (notmuch-test-wait) + (notmuch-tree-show-message nil) + (notmuch-test-wait) + "SUCCESS")' ) +test_expect_equal "$output" '"SUCCESS"' + +test_done -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: show a single message in a huge thread
Hello, On 2021-06-02 09:18, David Bremner writes: > The code I posted worked fine for me for one message from a thread of > 323 messages. The thread that used to crash (before your patch) was from DeltaChat, which is an email-based chat app. The thread it produces are like lists more than trees. So I guess the depth of the tree is what matters. Best, Alan signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: First attempt at a fix for single message display deep in thread
Hello, On 2021-06-02 20:31, David Bremner writes: > Alan, if you can test this, it would be great. You just need a copy of > the source, and to apply the following two patches. You can use > devel/try-emacs-mua to run the patched emacs front-end. Since the changes are small, I tested it the following way: I copied and manually applied the patch to the two functions modified, and I evaluated them. And it works! Thanks a lot. Best, Alan signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org