info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preprocessing message contents before displaying


From: Lowell Gilbert
Subject: Re: Preprocessing message contents before displaying
Date: Wed, 28 Mar 2012 19:15:51 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix)

Sean McAfee <eefacm@gmail.com> writes:

> I've been mildly irritated for a while now that whenever a co-worker
> sends me an HTML e-mail into which he's pasted some program code, the
> code is rendered with a blank line between each line.  I finally dug
> into the raw content of one such message, and discovered that each line
> of code is wrapped in its own <p> tag.  ಠ_ಠ
>
> Presumably there are some style rules somewhere that call for minimal
> bottom margins when the text is rendered graphically, but all of the
> text-based renderers I tried showed the code as double-spaced.
>
> So, what I'd like to do is tell Gnus that messages from this co-worker
> should be passed through a custom filter before being rendered, so I can
> remove all these confounding <p> tags and use <br> tags to break lines
> instead.  The content is encoded as quoted-printable, so ideally I'd
> hook into the rendering process after the content is decoded, but if
> necessary I could take the raw content, decode it, tweak it, and
> re-encode it.
>
> Can this be done?

Seems pretty tricky to me; there's no clear distinction between the
English text and the program code in the same part, so you'll probably
get unfortunate results if you do the same thing to the whole HTML
message part. Or maybe not, since the text "paragraphs" are likely to be
encoded as single lines... in which case there's a washing function for
removing multiple blank lines, which could probably be used as an
example to remove one from every set of blank lines.

Similarly, but slightly easier, you could code something up that does
the same thing for the active region, and call it interactively when
you're copying code out this fellow sends you. Assuming you use the
mouse to select the program code before copying it, this is a fairly
minimal number of keystrokes.

Good luck.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]