[PATCH 2/2] 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. --- emacs/notmuch-tree.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 13007a13..f111cb95 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 -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
First attempt at a fix for single message display deep in thread
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. The idea is that the notmuch-tree UI should be the same, but just not crash on displaying a message from large threads. If that still crashes (perhaps displaying the tree), please try (let ((notmuch-show-single-message t)) (notmuch show "id:foo")) I am curious if people thing the unthreaded view should work the same way, only displaying a single message. In the mean time I will try to write a test for large threads in emacs. I don't especially love the solution of adding yet another dynamically bound parameter, but I guess we can clean it up after we have something working. One option would be to make a seperate function for use showing a single message. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 1/2] 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
Re: show a single message in a huge thread
On Wed, Jun 02 2021, David Bremner wrote: > David Bremner writes: > >> Alan Schmitt writes: >> >>> Hello, >>> >>> On 2021-06-01 15:33, David Bremner writes: >>> > Is this a bug of notmuch-emacs? Is there a way to display a single > message independently of its context? > I'm not sure what the best UI is, but here is a start: (defun notmuch-show-single-message (query) (interactive "sQuery: ") (message query) (let ((notmuch-show-indent-messages-width 0) (notmuch-show-only-matching-messages t)) (notmuch-show query))) >>> >>> Thank you for the suggestion, unfortunately I get a very similar error. >>> I found the id of the message I want, and when I run this function, I >>> get this backtrace. >>> >> >> The code I posted worked fine for me for one message from a thread of >> 323 messages. It could be a I need a really giant thread to test, or >> perhaps the structure of the individual messages matters also. The long >> threads I have are from Debian mailing lists, so the message structure >> tests to be be mainly one part of plain text. > > I played with this some more, and I think I understand what the issue > is, although I still cannot duplicate the crash. By unless given the max-lisp-eval-depth is a variable defined in ‘C source code’. Its value is 800 Started second emacs, tried to set max-lisp-eval-depth to 10 (changed to 100, cannot go lower) then run notmuch (ya! you can do that -- no go w/ vm or gnus!) . I have too short threads to get that crashing :/ but perhaps someone else(tm) is luckier... ;/ Tomi > "--part" option the CLI returns the whole thread structure, even if it > does not populate it. So there is a big tree of empty lists, and > recursively traversing this tree is what is crashing. In principle > passing "--part=0" to the CLI should turn off this behaviour, but I > don't know how much needs to be changed on the emacs side to display the > result properly. ___ 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 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, ...) ? > > d Tomi ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: remap send-message and send-message-and-exit
On Tue, Jun 01 2021, e...@edef.eu wrote: > All three of C-c C-c, , > and are bound to message-send-and-exit by > message.el, but notmuch-mua.el only had an explicit override for the > keyboard binding. This mostly manifests as confusing Fcc behaviour for > GUI users. > > Patching the bindings for specific keys is rather brittle, since it has > to be aware of every relevant binding. This patch switches to instead After committed to repo this is no longer 'patch'. Simple change is to use 'commit', 'change', 'changeset' -- alternative is not to write 'This ...' but reword... > using a remap binding, which turns any binding for message-send or > message-send-and-exit into a binding for the corresponding notmuch-mua > command. > --- > The previous patch managed to *disappear* the menu item, but while > figuring out how to make that work correctly, I happened upon a much > simpler and less brittle solution. > > emacs/notmuch-mua.el | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index bbf059a2..8572aa1b 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -341,8 +341,8 @@ Typically this is added to `notmuch-mua-send-hook'." > > (defvar notmuch-message-mode-map >(let ((map (make-sparse-keymap))) > -(define-key map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) > -(define-key map (kbd "C-c C-s") #'notmuch-mua-send) > +(define-key map [remap message-send-and-exit] 'notmuch-mua-send-and-exit) > +(define-key map [remap message-send] 'notmuch-mua-send) where did the # characters disappear here ? afaic #' is the recommended way here... > (define-key map (kbd "C-c C-p") #'notmuch-draft-postpone) > (define-key map (kbd "C-x C-s") #'notmuch-draft-save) > map) > -- > 2.31.1 Tomi ___ 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
David Bremner writes: > Alan Schmitt writes: > >> Hello, >> >> On 2021-06-01 15:33, David Bremner writes: >> Is this a bug of notmuch-emacs? Is there a way to display a single message independently of its context? >>> >>> I'm not sure what the best UI is, but here is a start: >>> >>> (defun notmuch-show-single-message (query) >>> (interactive "sQuery: ") >>> (message query) >>> (let ((notmuch-show-indent-messages-width 0) >>> (notmuch-show-only-matching-messages t)) >>> (notmuch-show query))) >> >> Thank you for the suggestion, unfortunately I get a very similar error. >> I found the id of the message I want, and when I run this function, I >> get this backtrace. >> > > The code I posted worked fine for me for one message from a thread of > 323 messages. It could be a I need a really giant thread to test, or > perhaps the structure of the individual messages matters also. The long > threads I have are from Debian mailing lists, so the message structure > tests to be be mainly one part of plain text. I played with this some more, and I think I understand what the issue is, although I still cannot duplicate the crash. By unless given the "--part" option the CLI returns the whole thread structure, even if it does not populate it. So there is a big tree of empty lists, and recursively traversing this tree is what is crashing. In principle passing "--part=0" to the CLI should turn off this behaviour, but I don't know how much needs to be changed on the emacs side to display the result properly. ___ 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
Alan Schmitt writes: > Hello, > > On 2021-06-01 15:33, David Bremner writes: > >>> Is this a bug of notmuch-emacs? Is there a way to display a single >>> message independently of its context? >>> >> >> I'm not sure what the best UI is, but here is a start: >> >> (defun notmuch-show-single-message (query) >> (interactive "sQuery: ") >> (message query) >> (let ((notmuch-show-indent-messages-width 0) >> (notmuch-show-only-matching-messages t)) >> (notmuch-show query))) > > Thank you for the suggestion, unfortunately I get a very similar error. > I found the id of the message I want, and when I run this function, I > get this backtrace. > The code I posted worked fine for me for one message from a thread of 323 messages. It could be a I need a really giant thread to test, or perhaps the structure of the individual messages matters also. The long threads I have are from Debian mailing lists, so the message structure tests to be be mainly one part of plain text. d ___ 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-01 15:33, David Bremner writes: >> Is this a bug of notmuch-emacs? Is there a way to display a single >> message independently of its context? >> > > I'm not sure what the best UI is, but here is a start: > > (defun notmuch-show-single-message (query) > (interactive "sQuery: ") > (message query) > (let ((notmuch-show-indent-messages-width 0) > (notmuch-show-only-matching-messages t)) > (notmuch-show query))) Thank you for the suggestion, unfortunately I get a very similar error. I found the id of the message I want, and when I run this function, I get this backtrace. Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’") #f(compiled-function (tree) #)((nil ((nil ((nil ((nil ...))) (nil ((nil ... mapc(#f(compiled-function (tree) #) ((nil ((nil ((nil (...)) (nil (... notmuch-show-insert-thread(((nil ((nil ((nil (...)) (nil (...))) 195) notmuch-show-insert-tree((nil ((nil ((nil ((nil ...) (nil ...))) 194) #f(compiled-function (tree) #)((nil ((nil ((nil ((nil ...) (nil ... mapc(#f(compiled-function (tree) #) ((nil ((nil ((nil (... ... notmuch-show-insert-thread(((nil ((nil ((nil (... ...))) 194) notmuch-show-insert-tree((nil ((nil ((nil ((nil ...))) 193) #f(compiled-function (tree) #)((nil ((nil ((nil ((nil ... mapc(#f(compiled-function (tree) #) ((nil ((nil ((nil (... notmuch-show-insert-thread(((nil ((nil ((nil (...))) 193) …many line elided… notmuch-show-insert-tree((nil ((nil ((nil nil) (nil ((nil ...) (nil nil))) 1) #f(compiled-function (tree) #)((nil ((nil ((nil nil) (nil ((nil ...) (nil nil mapc(#f(compiled-function (tree) #) ((nil ((nil ((nil nil) (nil (... ... notmuch-show-insert-thread(((nil ((nil ((nil nil) (nil (... ...))) 1) notmuch-show-insert-tree((nil ((nil ((nil ((nil nil) (nil ...))) 0) #f(compiled-function (tree) #)((nil ((nil ((nil ((nil nil) (nil ... mapc(#f(compiled-function (tree) #) ((nil ((nil ((nil (... ... notmuch-show-insert-thread(((nil ((nil ((nil (... ...))) 0) #f(compiled-function (thread) #)(((nil ((nil ((nil (... ... mapc(#f(compiled-function (thread) #) (((nil ((nil ((nil ... notmuch-show-insert-forestnil ((nil ((nil ... notmuch-show--build-buffer() notmuch-show("id:mr.mcs31ym4nf_.pqmximnh...@petitepomme.net") (let ((notmuch-show-indent-messages-width 0) (notmuch-show-only-matching-messages t)) (notmuch-show query)) notmuch-show-single-message("id:mr.mcs31ym4nf_.pqmximnh...@petitepomme.net") funcall-interactively(notmuch-show-single-message "id:mr.mcs31ym4nf_.pqmximnh...@petitepomme.net") call-interactively(notmuch-show-single-message record nil) command-execute(notmuch-show-single-message record) This seems to be the same problem as when hitting RET on a tree-view buffer. Some huge forest is built, instead of showing the single message. (Or maybe the forest is built before deciding to show only the message, but there is a stack overflow before that.) Best, Alan signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org