File: deuglify.el.html
This file enables Gnus to repair broken citations produced by common user agents like MS Outlook (Express). It may repair articles of other user agents too.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Outlook sometimes wraps cited lines before sending a message as
seen in this example:
Example #1
----------
John Doe wrote:
> This sentence no verb. This sentence no verb. This sentence
no
> verb. This sentence no verb. This sentence no verb. This
> sentence no verb.
The function gnus-article-outlook-unwrap-lines tries to recognize those
erroneously wrapped lines and will unwrap them. I.e. putting the
wrapped parts ("no" in this example) back where they belong (at the
end of the cited line above).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note that some people not only use broken user agents but also
practice a bad citation style by omitting blank lines between the
cited text and their own text.
;:
Example #2
----------
John Doe wrote:
> This sentence no verb. This sentence no verb. This sentence no
You forgot in all your sentences.
> verb. This sentence no verb. This sentence no verb. This
> sentence no verb.
Unwrapping "You forgot in all your sentences." would be invalid as
this part wasn't intended to be cited text.
gnus-article-outlook-unwrap-lines will only unwrap lines if the resulting
citation line will be of a certain maximum length. You can control
this by adjusting gnus-outlook-deuglify-unwrap-max. Also
unwrapping will only be done if the line above the (possibly)
wrapped line has a minimum length of gnus-outlook-deuglify-unwrap-min.
Furthermore no unwrapping will be undertaken if the last character
is one of the chars specified in
gnus-outlook-deuglify-unwrap-stop-chars. Setting this to ".?!"
inhibits unwrapping if the cited line ends with a full stop,
question mark or exclamation mark. Note that this variable
defaults to nil, triggering a few false positives but generally
giving you better results.
Unwrapping works on every level of citation. Thus you will be able repair broken citations of broken user agents citing broken citations of broken user agents citing broken citations...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Citations are commonly introduced with an attribution line indicating who wrote the cited text. Outlook adds superfluous information that can be found in the header of the message to this line and often wraps it.
If that weren't enough, lots of people write their own text above the cited text and cite the complete original article below.
Example #3
----------
Hey, John. There's no in all your sentences!
John Doe <john.doe@some.domain> wrote in message
news:a87usw8$dklsssa$2@some.news.server...
> This sentence no verb. This sentence no verb. This sentence
no
> verb. This sentence no verb. This sentence no verb. This
> sentence no verb.
>
> Bye, John
Repairing the attribution line will be done by function
gnus-article-outlook-repair-attribution which calls other function that
try to recognize and repair broken attribution lines. See variable
gnus-outlook-deuglify-attrib-cut-regexp for stuff that should be
cut off from the beginning of an attribution line and variable
gnus-outlook-deuglify-attrib-verb-regexp for the verbs that are
required to be found in an attribution line. These function return
the point where the repaired attribution line starts.
Rearranging the article so that the cited text appears above the
new text will be done by function
gnus-article-outlook-rearrange-citation. This function calls
gnus-article-outlook-repair-attribution to find and repair an attribution
line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Well, and that's what the message will look like after applying deuglification:
Example #3 (deuglified)
-----------------------
John Doe <john.doe@some.domain> wrote:
> This sentence no verb. This sentence no verb. This sentence no
> verb. This sentence no verb. This sentence no verb. This
> sentence no verb.
>
> Bye, John
Hey, John. There's no in all your sentences!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Usage
-----
Press W k in the Summary Buffer.
Non recommended usage :-)
---------------------
To automatically invoke deuglification on every article you read, put something like that in your .gnus:
(add-hook 'gnus-article-decode-hook #'gnus-article-outlook-unwrap-lines)
or _one_ of the following lines:
;; repair broken attribution lines
(add-hook 'gnus-article-decode-hook #'gnus-article-outlook-repair-attribution)
;; repair broken attribution lines and citations
(add-hook 'gnus-article-decode-hook #'gnus-article-outlook-rearrange-citation)
Note that there always may be some false positives, so I suggest
using the manual invocation. After deuglification you may want to
refill the whole article using W w.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Limitations
-----------
As I said before there may (or will) be a few false positives on
unwrapping cited lines with gnus-article-outlook-unwrap-lines.
gnus-article-outlook-repair-attribution will only fix the first
attribution line found in the article. Furthermore it fixed to
certain kinds of attributions. And there may be horribly many
false positives, vanishing lines and so on -- so don't trust your
eyes. Again I recommend manual invocation.
gnus-article-outlook-rearrange-citation carries all the limitations of
gnus-article-outlook-repair-attribution.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
See commit log for other changes.
Revision 1.5 2002/01/27 14:39:17 rscholz
* New variable gnus-outlook-deuglify-no-wrap-chars to inhibit
unwrapping if one these chars is first in the possibly wrapped line.
* Improved rearranging of the article.
* New function gnus-outlook-repair-attribution-block for repairing
those big "Original Message (following some headers)" attributions.
Revision 1.4 2002/01/03 14:05:00 rscholz
Renamed gnus-outlook-deuglify-article to
gnus-article-outlook-deuglify-article.
Made it easier to deuglify the article while being in Gnus' Article
Edit Mode. (suggested by Phil Nitschke)
Revision 1.3 2002/01/02 23:35:54 rscholz
Fix a bug that caused succeeding long attribution lines to be
unwrapped. Minor doc fixes and regular expression tuning.
Revision 1.2 2001/12/30 20:14:34 rscholz
Clean up source.
Revision 1.1 2001/12/30 20:13:32 rscholz
Initial revision
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Defined variables (10)
gnus-outlook-deuglify-attrib-cut-regexp | Regexp matching beginning of attribution line that should be cut off. |
gnus-outlook-deuglify-attrib-end-regexp | Regular expression matching the end of an attribution line. |
gnus-outlook-deuglify-attrib-verb-regexp | Regular expression matching the verb used in an attribution line. |
gnus-outlook-deuglify-cite-marks | Characters that indicate cited lines. |
gnus-outlook-deuglify-no-wrap-chars | Characters that, when at beginning of line, inhibit unwrapping. |
gnus-outlook-deuglify-unwrap-max | Maximum length of the cited line after unwrapping. |
gnus-outlook-deuglify-unwrap-min | Minimum length of the cited line above the (possibly) wrapped line. |
gnus-outlook-deuglify-unwrap-stop-chars | Characters that, when at end of cited line, inhibit unwrapping. |
gnus-outlook-deuglify-version | Version of gnus-outlook-deuglify. |
gnus-outlook-display-hook | A hook called after a deuglified article has been prepared. |
Defined functions (10)
gnus-article-outlook-deuglify-article | () |
gnus-article-outlook-rearrange-citation | (&optional NODISPLAY) |
gnus-article-outlook-repair-attribution | (&optional NODISPLAY) |
gnus-article-outlook-unwrap-lines | (&optional NODISPLAY) |
gnus-outlook-deuglify-article | (&optional NODISPLAY) |
gnus-outlook-display-article-buffer | () |
gnus-outlook-rearrange-article | (ATTR-START) |
gnus-outlook-repair-attribution-block | () |
gnus-outlook-repair-attribution-other | () |
gnus-outlook-repair-attribution-outlook | () |