unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* show a single message in a huge thread
@ 2021-05-28 10:10 alan.schmitt
  2021-05-28 12:37 ` David Bremner
  2021-05-28 16:01 ` Jameson Graef Rollins
  0 siblings, 2 replies; 18+ messages in thread
From: alan.schmitt @ 2021-05-28 10:10 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 653 bytes --]

Hello,

I want to see a message in a huge thread (too big for notmuch to
display). To find it, I switch to unthreaded mode, I select the message
(I hit RET), but then notmuch tries to show all the other messages as
well (which makes it hang as the thread is too big, and one of the
message results in an error "symbolp: Lisp nesting exceeds
‘max-lisp-eval-depth’", which prevents later messages from being
displayed).

I tried doing C-u RET, but I immediately get a similar error:
"notmuch-show-insert-thread: Lisp nesting exceeds
‘max-lisp-eval-depth’".

Is there a way to view a single message from a thread?

Thanks,

Alan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-05-28 10:10 show a single message in a huge thread alan.schmitt
@ 2021-05-28 12:37 ` David Bremner
  2021-05-28 14:16   ` Alan Schmitt
  2021-05-28 16:01 ` Jameson Graef Rollins
  1 sibling, 1 reply; 18+ messages in thread
From: David Bremner @ 2021-05-28 12:37 UTC (permalink / raw)
  To: alan.schmitt, notmuch

alan.schmitt@polytechnique.org writes:

> Hello,
>
> I want to see a message in a huge thread (too big for notmuch to
> display). To find it, I switch to unthreaded mode, I select the message
> (I hit RET), but then notmuch tries to show all the other messages as
> well (which makes it hang as the thread is too big, and one of the
> message results in an error "symbolp: Lisp nesting exceeds
> ‘max-lisp-eval-depth’", which prevents later messages from being
> displayed).

Did you try M-x notuch-tree ?

It displays messages one at a time.

Starting from notmuch-search-mode, you could

- use Z to switch to tree mode, then select the message you
  want.

- If that is too tedious, use 'z' to search for something more precise,
  and report the results in tree-mode.
\r

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-05-28 12:37 ` David Bremner
@ 2021-05-28 14:16   ` Alan Schmitt
  2021-06-01  6:57     ` Alan Schmitt
  0 siblings, 1 reply; 18+ messages in thread
From: Alan Schmitt @ 2021-05-28 14:16 UTC (permalink / raw)
  To: David Bremner, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 3480 bytes --]

Hello,

On 2021-05-28 09:37, David Bremner <david@tethera.net> writes:

> Did you try M-x notuch-tree ?
>
> It displays messages one at a time.
>
> Starting from notmuch-search-mode, you could
>
> - use Z to switch to tree mode, then select the message you
>   want.
>
> - If that is too tedious, use 'z' to search for something more precise,
>   and report the results in tree-mode.

Thank you for the suggestion. Here is what I did:
- run the search
- execute notmuch-tree-from-search-current-query
- hit RET on a message deep in the thread
- I get this error

Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
  mapc(#f(compiled-function (tree) #<bytecode 0x157598d929e1>) ((nil nil)))
  notmuch-show-insert-thread(((nil nil)) 247)
  notmuch-show-insert-tree((nil ((nil nil))) 246)
  #f(compiled-function (tree) #<bytecode 0x157598d929cd>)((nil ((nil nil))))
  mapc(#f(compiled-function (tree) #<bytecode 0x157598d929cd>) ((nil ((nil nil))) (nil ((nil ((nil nil) (nil (... ...))))))))
  notmuch-show-insert-thread(((nil ((nil nil))) (nil ((nil ((nil nil) (nil (... ...))))))) 246)
  notmuch-show-insert-tree((nil ((nil ((nil nil))) (nil ((nil ((nil nil) (nil ...))))))) 245)
  #f(compiled-function (tree) #<bytecode 0x157598d929a5>)((nil ((nil ((nil nil))) (nil ((nil ((nil nil) (nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x157598d929a5>) ((nil nil) (nil ((nil ((nil nil))) (nil ((nil (... ...))))))))
  notmuch-show-insert-thread(((nil nil) (nil ((nil ((nil nil))) (nil ((nil (... ...))))))) 245)
  ...many lines elided...
  notmuch-show-insert-tree((nil ((nil nil) (nil ((nil ((nil ...))) (nil nil))))) 2)
  #f(compiled-function (tree) #<bytecode 0x157598755bbd>)((nil ((nil nil) (nil ((nil ((nil ...))) (nil nil))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x157598755bbd>) ((nil ((nil nil) (nil ((nil (...)) (nil nil)))))))
  notmuch-show-insert-thread(((nil ((nil nil) (nil ((nil (...)) (nil nil)))))) 2)
  notmuch-show-insert-tree((nil ((nil ((nil nil) (nil ((nil ...) (nil nil))))))) 1)
  #f(compiled-function (tree) #<bytecode 0x157598755ba9>)((nil ((nil ((nil nil) (nil ((nil ...) (nil nil))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x157598755ba9>) ((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) #<bytecode 0x157598755b95>)((nil ((nil ((nil ((nil nil) (nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x157598755b95>) ((nil ((nil ((nil (... ...))))))))
  notmuch-show-insert-thread(((nil ((nil ((nil (... ...))))))) 0)
  #f(compiled-function (thread) #<bytecode 0x15758dc8b4f5>)(((nil ((nil ((nil (... ...))))))))
  mapc(#f(compiled-function (thread) #<bytecode 0x15758dc8b4f5>) (((nil ((nil ((nil ...))))))))
  notmuch-show-insert-forest((((nil ((nil ((nil ...))))))))
  notmuch-show--build-buffer()
  notmuch-show("id:Mr.mCS31Ym4nF_.pqMxIMnhICF@petitepomme.net")
  notmuch-tree-show-message-in()
  notmuch-tree-show-message(nil)
  funcall-interactively(notmuch-tree-show-message nil)
  call-interactively(notmuch-tree-show-message nil nil)
  command-execute(notmuch-tree-show-message)

I’m afraid I may have an option asking for the context (as a big forest
is built), but I don’t know which one or how to disable it.

Best,

Alan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-05-28 10:10 show a single message in a huge thread alan.schmitt
  2021-05-28 12:37 ` David Bremner
@ 2021-05-28 16:01 ` Jameson Graef Rollins
  1 sibling, 0 replies; 18+ messages in thread
From: Jameson Graef Rollins @ 2021-05-28 16:01 UTC (permalink / raw)
  To: alan.schmitt, notmuch

On Fri, May 28 2021, alan.schmitt@polytechnique.org wrote:
> Hello,
>
> I want to see a message in a huge thread (too big for notmuch to
> display). To find it, I switch to unthreaded mode, I select the message
> (I hit RET), but then notmuch tries to show all the other messages as
> well (which makes it hang as the thread is too big, and one of the
> message results in an error "symbolp: Lisp nesting exceeds
> ‘max-lisp-eval-depth’", which prevents later messages from being
> displayed).
>
> I tried doing C-u RET, but I immediately get a similar error:
> "notmuch-show-insert-thread: Lisp nesting exceeds
> ‘max-lisp-eval-depth’".

I will concur that notmuch-emacs has very poor performance with really
long threads.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-05-28 14:16   ` Alan Schmitt
@ 2021-06-01  6:57     ` Alan Schmitt
  2021-06-01 18:33       ` David Bremner
  0 siblings, 1 reply; 18+ messages in thread
From: Alan Schmitt @ 2021-06-01  6:57 UTC (permalink / raw)
  To: David Bremner, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 501 bytes --]

Hello,

On 2021-05-28 16:16, Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Thank you for the suggestion. Here is what I did:
> - run the search
> - execute notmuch-tree-from-search-current-query
> - hit RET on a message deep in the thread
> - I get this error
>
> Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")

Is this a bug of notmuch-emacs? Is there a way to display a single
message independently of its context?

Thanks,

Alan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-01  6:57     ` Alan Schmitt
@ 2021-06-01 18:33       ` David Bremner
  2021-06-01 18:48         ` Jameson Graef Rollins
  2021-06-02  6:46         ` Alan Schmitt
  0 siblings, 2 replies; 18+ messages in thread
From: David Bremner @ 2021-06-01 18:33 UTC (permalink / raw)
  To: Alan Schmitt, notmuch

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> On 2021-05-28 16:16, Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Thank you for the suggestion. Here is what I did:
>> - run the search
>> - execute notmuch-tree-from-search-current-query
>> - hit RET on a message deep in the thread
>> - I get this error
>>
>> Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
>
> 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)))

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-01 18:33       ` David Bremner
@ 2021-06-01 18:48         ` Jameson Graef Rollins
  2021-06-02  6:46         ` Alan Schmitt
  1 sibling, 0 replies; 18+ messages in thread
From: Jameson Graef Rollins @ 2021-06-01 18:48 UTC (permalink / raw)
  To: David Bremner, Alan Schmitt, notmuch

On Tue, Jun 01 2021, David Bremner <david@tethera.net> wrote:
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Hello,
>>
>> On 2021-05-28 16:16, Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>>
>>> Thank you for the suggestion. Here is what I did:
>>> - run the search
>>> - execute notmuch-tree-from-search-current-query
>>> - hit RET on a message deep in the thread
>>> - I get this error
>>>
>>> Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
>>
>> 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)))

It used to be that if a search returned only a single message that
message would just be displayed directly, by passing the thread view.
I'm not sure when/why that changed.

jamie.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-01 18:33       ` David Bremner
  2021-06-01 18:48         ` Jameson Graef Rollins
@ 2021-06-02  6:46         ` Alan Schmitt
  2021-06-02 12:18           ` David Bremner
  1 sibling, 1 reply; 18+ messages in thread
From: Alan Schmitt @ 2021-06-02  6:46 UTC (permalink / raw)
  To: David Bremner, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 3512 bytes --]

Hello,

On 2021-06-01 15:33, David Bremner <david@tethera.net> 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) #<bytecode 0x1590027e5e8d>)((nil ((nil ((nil ((nil ...))) (nil ((nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x1590027e5e8d>) ((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) #<bytecode 0x1590027e5e75>)((nil ((nil ((nil ((nil ...) (nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x1590027e5e75>) ((nil ((nil ((nil (... ...))))))))
  notmuch-show-insert-thread(((nil ((nil ((nil (... ...))))))) 194)
  notmuch-show-insert-tree((nil ((nil ((nil ((nil ...))))))) 193)
  #f(compiled-function (tree) #<bytecode 0x1590027e5e5d>)((nil ((nil ((nil ((nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x1590027e5e5d>) ((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) #<bytecode 0x159002a52c05>)((nil ((nil ((nil nil) (nil ((nil ...) (nil nil))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x159002a52c05>) ((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) #<bytecode 0x159002a52bed>)((nil ((nil ((nil ((nil nil) (nil ...))))))))
  mapc(#f(compiled-function (tree) #<bytecode 0x159002a52bed>) ((nil ((nil ((nil (... ...))))))))
  notmuch-show-insert-thread(((nil ((nil ((nil (... ...))))))) 0)
  #f(compiled-function (thread) #<bytecode 0x158ffe837651>)(((nil ((nil ((nil (... ...))))))))
  mapc(#f(compiled-function (thread) #<bytecode 0x158ffe837651>) (((nil ((nil ((nil ...))))))))
  notmuch-show-insert-forest((((nil ((nil ((nil ...))))))))
  notmuch-show--build-buffer()
  notmuch-show("id:Mr.mCS31Ym4nF_.pqMxIMnhICF@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_.pqMxIMnhICF@petitepomme.net")
  funcall-interactively(notmuch-show-single-message "id:Mr.mCS31Ym4nF_.pqMxIMnhICF@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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-02  6:46         ` Alan Schmitt
@ 2021-06-02 12:18           ` David Bremner
  2021-06-02 16:02             ` David Bremner
  2021-06-03  7:55             ` show a single message in a huge thread Alan Schmitt
  0 siblings, 2 replies; 18+ messages in thread
From: David Bremner @ 2021-06-02 12:18 UTC (permalink / raw)
  To: Alan Schmitt, notmuch

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> On 2021-06-01 15:33, David Bremner <david@tethera.net> 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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-02 12:18           ` David Bremner
@ 2021-06-02 16:02             ` David Bremner
  2021-06-02 19:19               ` Tomi Ollila
  2021-06-03  7:55             ` show a single message in a huge thread Alan Schmitt
  1 sibling, 1 reply; 18+ messages in thread
From: David Bremner @ 2021-06-02 16:02 UTC (permalink / raw)
  To: Alan Schmitt, notmuch

David Bremner <david@tethera.net> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Hello,
>>
>> On 2021-06-01 15:33, David Bremner <david@tethera.net> 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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-02 16:02             ` David Bremner
@ 2021-06-02 19:19               ` Tomi Ollila
  2021-06-02 23:31                 ` First attempt at a fix for single message display deep in thread David Bremner
  0 siblings, 1 reply; 18+ messages in thread
From: Tomi Ollila @ 2021-06-02 19:19 UTC (permalink / raw)
  To: David Bremner, Alan Schmitt, notmuch

On Wed, Jun 02 2021, David Bremner wrote:

> David Bremner <david@tethera.net> writes:
>
>> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>>
>>> Hello,
>>>
>>> On 2021-06-01 15:33, David Bremner <david@tethera.net> 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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* First attempt at a fix for single message display deep in thread
  2021-06-02 19:19               ` Tomi Ollila
@ 2021-06-02 23:31                 ` David Bremner
  2021-06-02 23:31                   ` [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message David Bremner
                                     ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: David Bremner @ 2021-06-02 23:31 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Alan Schmitt, notmuch

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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message
  2021-06-02 23:31                 ` First attempt at a fix for single message display deep in thread David Bremner
@ 2021-06-02 23:31                   ` David Bremner
  2021-06-02 23:31                   ` [PATCH 2/2] emacs/tree: use notmuch-show-single-message David Bremner
  2021-06-03  7:53                   ` First attempt at a fix for single message display deep in thread Alan Schmitt
  2 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2021-06-02 23:31 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Alan Schmitt, notmuch

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 2/2] emacs/tree: use notmuch-show-single-message
  2021-06-02 23:31                 ` First attempt at a fix for single message display deep in thread David Bremner
  2021-06-02 23:31                   ` [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message David Bremner
@ 2021-06-02 23:31                   ` David Bremner
  2021-06-03  7:53                   ` First attempt at a fix for single message display deep in thread Alan Schmitt
  2 siblings, 0 replies; 18+ messages in thread
From: David Bremner @ 2021-06-02 23:31 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Alan Schmitt, notmuch

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: First attempt at a fix for single message display deep in thread
  2021-06-02 23:31                 ` First attempt at a fix for single message display deep in thread David Bremner
  2021-06-02 23:31                   ` [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message David Bremner
  2021-06-02 23:31                   ` [PATCH 2/2] emacs/tree: use notmuch-show-single-message David Bremner
@ 2021-06-03  7:53                   ` Alan Schmitt
  2 siblings, 0 replies; 18+ messages in thread
From: Alan Schmitt @ 2021-06-03  7:53 UTC (permalink / raw)
  To: David Bremner, Tomi Ollila, David Bremner, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 464 bytes --]

Hello,

On 2021-06-02 20:31, David Bremner <david@tethera.net> 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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-02 12:18           ` David Bremner
  2021-06-02 16:02             ` David Bremner
@ 2021-06-03  7:55             ` Alan Schmitt
  2021-06-11 16:45               ` Jonathan Wilner
  1 sibling, 1 reply; 18+ messages in thread
From: Alan Schmitt @ 2021-06-03  7:55 UTC (permalink / raw)
  To: David Bremner, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 383 bytes --]

Hello,

On 2021-06-02 09:18, David Bremner <david@tethera.net> 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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-03  7:55             ` show a single message in a huge thread Alan Schmitt
@ 2021-06-11 16:45               ` Jonathan Wilner
  2021-06-12 20:39                 ` Tomi Ollila
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Wilner @ 2021-06-11 16:45 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 1062 bytes --]

I definitely also have this problem with large threads - big time hangs
using Notmuch in Emacs. My simple tests indicate that it happens in Emacs,
not using Notmuch at the command line, though that can also take quite a
long time to return.

I'm suspicious that there's something with HTML parsing - does that seem
possible? It might also make sense if Delta Chat is giving you HTML versus
plaintext.



On Thu, Jun 3, 2021 at 12:55 AM Alan Schmitt <alan.schmitt@polytechnique.org>
wrote:

> Hello,
>
> On 2021-06-02 09:18, David Bremner <david@tethera.net> 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
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
>

[-- Attachment #1.2: Type: text/html, Size: 1661 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: show a single message in a huge thread
  2021-06-11 16:45               ` Jonathan Wilner
@ 2021-06-12 20:39                 ` Tomi Ollila
  0 siblings, 0 replies; 18+ messages in thread
From: Tomi Ollila @ 2021-06-12 20:39 UTC (permalink / raw)
  To: Jonathan Wilner, Alan Schmitt; +Cc: notmuch

On Fri, Jun 11 2021, Jonathan Wilner wrote:

> I definitely also have this problem with large threads - big time hangs
> using Notmuch in Emacs. My simple tests indicate that it happens in Emacs,
> not using Notmuch at the command line, though that can also take quite a
> long time to return.
>
> I'm suspicious that there's something with HTML parsing - does that seem
> possible? It might also make sense if Delta Chat is giving you HTML versus
> plaintext.

one thing you could also try is to press '<' in that notmuch show buffer
adn observe how long it takes to drop indentation of the whole buffer (i
don't remember how it does that) and then repres '<' and see whether
re-indenting takes much more time dropping indentation.

in notmuch show there is
(defvar-local notmuch-show-indent-content t)

I tried just to M-: (setq notmuch-show-indent-content nil) -- that did not
have any effect... 

IIRC the (indent-rigidly ...) executions take quite a lot of time but is
that significant or not here...


Tomi

>
>
>
> On Thu, Jun 3, 2021 at 12:55 AM Alan Schmitt <alan.schmitt@polytechnique.org>
> wrote:
>
>> Hello,
>>
>> On 2021-06-02 09:18, David Bremner <david@tethera.net> 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
>> _______________________________________________
>> notmuch mailing list -- notmuch@notmuchmail.org
>> To unsubscribe send an email to notmuch-leave@notmuchmail.org
>>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-06-12 20:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 10:10 show a single message in a huge thread alan.schmitt
2021-05-28 12:37 ` David Bremner
2021-05-28 14:16   ` Alan Schmitt
2021-06-01  6:57     ` Alan Schmitt
2021-06-01 18:33       ` David Bremner
2021-06-01 18:48         ` Jameson Graef Rollins
2021-06-02  6:46         ` Alan Schmitt
2021-06-02 12:18           ` David Bremner
2021-06-02 16:02             ` David Bremner
2021-06-02 19:19               ` Tomi Ollila
2021-06-02 23:31                 ` First attempt at a fix for single message display deep in thread David Bremner
2021-06-02 23:31                   ` [PATCH 1/2] emacs/show: add parameter notmuch-show-single-message David Bremner
2021-06-02 23:31                   ` [PATCH 2/2] emacs/tree: use notmuch-show-single-message David Bremner
2021-06-03  7:53                   ` First attempt at a fix for single message display deep in thread Alan Schmitt
2021-06-03  7:55             ` show a single message in a huge thread Alan Schmitt
2021-06-11 16:45               ` Jonathan Wilner
2021-06-12 20:39                 ` Tomi Ollila
2021-05-28 16:01 ` Jameson Graef Rollins

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git