* Treat article body iff header matches predicate?
@ 2019-03-20 10:30 Damien Collard
2019-03-20 11:31 ` Fraga, Eric
0 siblings, 1 reply; 9+ messages in thread
From: Damien Collard @ 2019-03-20 10:30 UTC (permalink / raw)
To: info-gnus-english
Hello,
I receive posts from a Discourse forum as e-mails, but their quote
(citation) format has poor readability, so I have written a treatment
function that converts such quotes into the usual e-mail citation
format.
I added this function to `gnus-treatment-function-alist', it is applied
to all parts (associated treatment variable set to t) and it works fine.
Now, currently this treatment is performed regardless of the provenance
of an e-mail, while I'd like it to be performed /iff/ the e-mail is
actually from Discourse.
From "Customizing articles" in Gnus' manual, there is no way to set a
treatment variable so the treatment applies to /both/ header and body.
However, a treatment variable can also be set to a "list where the first
element is not a string", and in that case it is interpreted as a
predicate. I tried using the `from` predicate as available in
`nnmail-split-fancy`, but it isn't recognized.
Is there a way to access the headers from a treatment function?
--
Damien Collard
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-20 10:30 Treat article body iff header matches predicate? Damien Collard
@ 2019-03-20 11:31 ` Fraga, Eric
2019-03-20 12:25 ` Damien Collard
2019-03-22 7:49 ` Damien Collard
0 siblings, 2 replies; 9+ messages in thread
From: Fraga, Eric @ 2019-03-20 11:31 UTC (permalink / raw)
To: Damien Collard; +Cc: info-gnus-english
On Wednesday, 20 Mar 2019 at 11:30, Damien Collard wrote:
> I receive posts from a Discourse forum as e-mails, but their quote
> (citation) format has poor readability, so I have written a treatment
> function that converts such quotes into the usual e-mail citation
> format.
One of the mailing lists I follow uses discourse (which I find very
annoying but so be it). I would love to see your treatment
function. Are you able to share it?
Thanks,
eric
--
Eric S Fraga via Emacs 27.0.50 & org 9.2.2 on Debian buster/sid
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-20 11:31 ` Fraga, Eric
@ 2019-03-20 12:25 ` Damien Collard
2019-03-20 14:04 ` Fraga, Eric
2019-03-22 7:49 ` Damien Collard
1 sibling, 1 reply; 9+ messages in thread
From: Damien Collard @ 2019-03-20 12:25 UTC (permalink / raw)
To: Fraga, Eric; +Cc: info-gnus-english
On Mer, mar 20 2019, Fraga, Eric wrote:
> One of the mailing lists I follow uses discourse (which I find very
> annoying but so be it). I would love to see your treatment
> function. Are you able to share it?
Sure, here it is, freshly uploaded:
https://github.com/damiencollard/discourse-article
(Still WIP.)
--
Damien Collard
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-20 12:25 ` Damien Collard
@ 2019-03-20 14:04 ` Fraga, Eric
0 siblings, 0 replies; 9+ messages in thread
From: Fraga, Eric @ 2019-03-20 14:04 UTC (permalink / raw)
To: Damien Collard; +Cc: info-gnus-english
On Wednesday, 20 Mar 2019 at 13:25, Damien Collard wrote:
> Sure, here it is, freshly uploaded:
>
> https://github.com/damiencollard/discourse-article
>
> (Still WIP.)
Thanks and noted.
--
Eric S Fraga via Emacs 27.0.50 & org 9.2.2 on Debian buster/sid
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-20 11:31 ` Fraga, Eric
2019-03-20 12:25 ` Damien Collard
@ 2019-03-22 7:49 ` Damien Collard
2019-03-22 8:15 ` Adam Sjøgren
1 sibling, 1 reply; 9+ messages in thread
From: Damien Collard @ 2019-03-22 7:49 UTC (permalink / raw)
To: Fraga, Eric; +Cc: info-gnus-english
Hello,
Here's version 0.0.2 of the Discourse Article treatment. It's far from
perfect but I find it pretty usable already:
https://github.com/damiencollard/discourse-article
It adds the following treatments (each controlled separately, see group
`discourse-article`):
* Code + Paragraphs : separate fenced code blocks into their own
paragraphs and fillwrap non-code paragraphs.
* Prettify Discourse links from `[label](url)` to highlighted and
clickable `label`.
* Prettify the previous replies at the bottom of e-mails (provided you
enabled this setting in your Discourse forum account).
(See screenshot at the above URL.)
Comments welcome!
--
Damien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-22 7:49 ` Damien Collard
@ 2019-03-22 8:15 ` Adam Sjøgren
2019-03-22 8:51 ` Damien Collard
2019-03-22 12:46 ` Damien Collard
0 siblings, 2 replies; 9+ messages in thread
From: Adam Sjøgren @ 2019-03-22 8:15 UTC (permalink / raw)
To: info-gnus-english
Damien writes:
> (See screenshot at the above URL.)
>
> Comments welcome!
Cool! How about a "before" screenshot as well?
:-),
Adam
--
"Everything needs to change. Adam Sjøgren
And it has to start today." asjo@koldfront.dk
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-22 8:15 ` Adam Sjøgren
@ 2019-03-22 8:51 ` Damien Collard
2019-03-22 12:46 ` Damien Collard
1 sibling, 0 replies; 9+ messages in thread
From: Damien Collard @ 2019-03-22 8:51 UTC (permalink / raw)
To: info-gnus-english
On Ven, mar 22 2019, Adam Sjøgren wrote:
> Cool! How about a "before" screenshot as well?
Yes, I did that for nice-citation but forgot to do it for
discourse-article ! Will do :-)
--
Damien
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-22 8:15 ` Adam Sjøgren
2019-03-22 8:51 ` Damien Collard
@ 2019-03-22 12:46 ` Damien Collard
2019-03-22 18:05 ` Adam Sjøgren
1 sibling, 1 reply; 9+ messages in thread
From: Damien Collard @ 2019-03-22 12:46 UTC (permalink / raw)
To: info-gnus-english
On Ven, mar 22 2019, Adam Sjøgren wrote:
> Cool! How about a "before" screenshot as well?
Done! -- https://github.com/damiencollard/discourse-article
One question, if I may: Do you receive Discourse articles from
`@discoursemail.com` or from another domain? Not asking which one
specifically, but I have the domain hardcoded at the moment, and I
should probably make it customizable...
--
Damien
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Treat article body iff header matches predicate?
2019-03-22 12:46 ` Damien Collard
@ 2019-03-22 18:05 ` Adam Sjøgren
0 siblings, 0 replies; 9+ messages in thread
From: Adam Sjøgren @ 2019-03-22 18:05 UTC (permalink / raw)
To: info-gnus-english
Damien writes:
> On Ven, mar 22 2019, Adam Sjøgren wrote:
>
>> Cool! How about a "before" screenshot as well?
>
> Done! -- https://github.com/damiencollard/discourse-article
The [quote]...[/quote] conversion looks nice!
If I was subscribed to emails like this, I would probably prefer to not
have the "Previous replies" shown at all, as I assume they would be
copies of emails I had already received, threaded nicely in Gnus?
> One question, if I may: Do you receive Discourse articles from
> `@discoursemail.com` or from another domain? Not asking which one
> specifically, but I have the domain hardcoded at the moment, and I
> should probably make it customizable...
I don't subscribe to any discourse discussions, so I don't know...
But let me try subscribing to something on the Haskell discourse.
I will return if I get some emails.
Best regards,
Adam
--
"Everything needs to change. Adam Sjøgren
And it has to start today." asjo@koldfront.dk
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-03-22 18:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 10:30 Treat article body iff header matches predicate? Damien Collard
2019-03-20 11:31 ` Fraga, Eric
2019-03-20 12:25 ` Damien Collard
2019-03-20 14:04 ` Fraga, Eric
2019-03-22 7:49 ` Damien Collard
2019-03-22 8:15 ` Adam Sjøgren
2019-03-22 8:51 ` Damien Collard
2019-03-22 12:46 ` Damien Collard
2019-03-22 18:05 ` Adam Sjøgren
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 NNTP newsgroup(s).