From: yoctocell <public@yoctocell.xyz>
To: Kyle Meyer <kyle@kyleam.com>
Cc: piem@inbox.kyleam.com
Subject: Re: [RFC PATCH] gnus: Add piem-gnus-mid-to-thread
Date: Tue, 19 Jan 2021 09:32:54 +0100 [thread overview]
Message-ID: <87zh159vih.fsf@yoctocell.xyz> (raw)
In-Reply-To: <874kjdlfvf.fsf@kyleam.com>
On Mon, Jan 18 2021, Kyle Meyer wrote:
>> ---
>> The function works as expected when running
>> 'M-: (funcall (piem-gnus-mid-thread t))', but when running
>> piem-b4-am-from-mid interactively, it just inserts an empty string.
>>
>> Any ideas of why this happens? Sorry, my elisp skills are not that great.
>
> Yes, I think you just need to move the lambda deeper so that the
> messages are collected outside of the returned function.
Ok, I will see if this works.
>> diff --git a/piem-gnus.el b/piem-gnus.el
>> index 5f10be8..f91f91c 100644
>> --- a/piem-gnus.el
>> +++ b/piem-gnus.el
>> @@ -58,6 +58,30 @@
>> ;; If there is an easy way to generate an mbox for a thread in Gnus, a
>> ;; function for `piem-mid-to-thread-functions' should be defined.
>>
>> +(defun piem-gnus-mid-to-thread (_mid)
>
> Hmm, yeah, I don't think we can convince Gnus to do much useful with the
> message ID here. However, perhaps there should at least be a check that
> the given message ID matches the one for the article at point before
> returning a function (i.e. claiming piem-gnus-mid-to-thread can generate
> a thread for the given MID).
>
> Also, I think this would need to be guarded by
>
> (derived-mode-p 'gnus-summary-mode)
Yeah, that's a good idea. `gnus-summary-refer-parent-article` doesn't
seem to work in article mode.
>> + (save-excursion
>> + ;; Cursor has to be at the root of the thread
>> + (gnus-summary-refer-parent-article most-positive-fixnum)
>> + (let ((articles (gnus-summary-articles-in-thread))
>> + message
>> + ;; Just show raw message
>> + (gnus-have-all-headers t)
>> + gnus-article-prepare-hook
>> + gnus-article-decode-hook
>> + gnus-display-mime-function
>> + gnus-break-pages)
>
> Is the above set of variables (or this approach in general) based off of
> an example from the Gnus source code?
Yeah, I had to do quite a bit of digging to figure this out. You can
find them in the definition of `gnus-summary-show-article`.
>> + (mapc (lambda (article)
>> + (gnus-summary-display-article article)
>> + (push (format "From mboxrd@z Thu Jan 1 00:00:00 1970\n%s\n"
>> + (with-current-buffer gnus-article-buffer
>> + (buffer-substring-no-properties
>> + (point-min)
>> + (point-max))))
>> + message))
>> + articles)
>
> For mboxrd, I suppose there needs to be some From-munging.
Sorry, I don't really know much about mbox, I just copied the line from
the mbox file generated by public-inbox :)
next prev parent reply other threads:[~2021-01-19 8:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 10:34 [RFC PATCH] gnus: Add piem-gnus-mid-to-thread Xinglu Chen
2021-01-19 4:17 ` Kyle Meyer
2021-01-19 8:32 ` yoctocell [this message]
2021-01-19 23:41 ` Kyle Meyer
2021-01-20 7:27 ` Xinglu Chen
2021-01-20 8:56 ` [RFC PATCH v2] " Xinglu Chen
2021-01-21 2:45 ` Kyle Meyer
2021-01-21 8:36 ` Xinglu Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://git.kyleam.com/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh159vih.fsf@yoctocell.xyz \
--to=public@yoctocell.xyz \
--cc=kyle@kyleam.com \
--cc=piem@inbox.kyleam.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.kyleam.com/piem/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).