Gnus development mailing list
 help / color / mirror / Atom feed
From: Michael Cook <michael.cook@cisco.com>
Subject: Re: gnus-article-unsplit-urls
Date: Fri, 08 Feb 2002 09:19:21 -0500	[thread overview]
Message-ID: <g08heosnjiu.fsf@zzz.cisco.com> (raw)
In-Reply-To: <g081yh65fip.fsf@zzz.cisco.com> (Michael Cook's message of "Fri, 04 Jan 2002 09:58:54 -0500")

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Michael Cook <michael.cook@cisco.com> writes:

> for certain mail user agents (like ms outlook), if the user types a
> long url into a message they are composing, as the agent sends the
> message, the agent will graciously insert a newline into the url
> rendering the url unclickable by the recipients.

ok, how's this patch?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: unsplit-urls.patch --]
[-- Type: text/x-patch, Size: 4263 bytes --]

--- lisp/gnus-art.el.DIST	Tue Feb  5 10:58:24 2002
+++ lisp/gnus-art.el	Fri Feb  8 09:06:45 2002
@@ -858,6 +858,13 @@
   :group 'gnus-article-treat
   :type gnus-article-treat-custom)
 
+(defcustom gnus-treat-unsplit-urls nil
+  "Remove newlines from within URLs.
+Valid values are nil, t, `head', `last', an integer or a predicate.
+See Info node `(gnus)Customizing Articles' for details."
+  :group 'gnus-article-treat
+  :type gnus-article-treat-custom)
+
 (defcustom gnus-treat-leading-whitespace nil
   "Remove leading whitespace in headers.
 Valid values are nil, t, `head', `last', an integer or a predicate.
@@ -1223,6 +1230,7 @@
     (gnus-treat-fill-article gnus-article-fill-cited-article)
     (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
     (gnus-treat-strip-cr gnus-article-remove-cr)
+    (gnus-treat-unsplit-urls gnus-article-unsplit-urls)
     (gnus-treat-date-ut gnus-article-date-ut)
     (gnus-treat-date-local gnus-article-date-local)
     (gnus-treat-date-english gnus-article-date-english)
@@ -2048,6 +2056,16 @@
     (let ((buffer-read-only nil))
       (rfc1843-decode-region (point-min) (point-max)))))
 
+(defun article-unsplit-urls ()
+  "Remove the newlines that some other mailers insert into URLs."
+  (interactive)
+  (save-excursion
+    (let ((buffer-read-only nil))
+      (goto-char (point-min))
+      (while (re-search-forward
+	      "^\\(\\(https?\\|ftp\\)://\\S-+\\)\n\\(\\S-+\\)" nil t)
+	(replace-match "\\1\\3" t)))))
+
 (defun article-wash-html (&optional read-charset)
   "Format an html article.
 If READ-CHARSET, ask for a coding system."
@@ -3172,6 +3190,7 @@
      article-de-base64-unreadable
      article-decode-HZ
      article-wash-html
+     article-unsplit-urls
      article-hide-list-identifiers
      article-hide-pgp
      article-strip-banner
@@ -3268,6 +3287,7 @@
        ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
        ["Remove base64" gnus-article-de-base64-unreadable t]
        ["Treat html" gnus-article-wash-html t]
+       ["Remove newlines from within URLs" gnus-article-unsplit-urls t]
        ["Decode HZ" gnus-article-decode-HZ t]))
 
     ;; Note "Commands" menu is defined in gnus-sum.el for consistency
--- lisp/gnus.el.DIST	Sat Feb  2 08:54:16 2002
+++ lisp/gnus.el	Fri Feb  8 09:06:45 2002
@@ -2110,6 +2110,7 @@
       gnus-article-de-base64-unreadable
       gnus-article-decode-HZ
       gnus-article-wash-html
+      gnus-article-unsplit-urls
       gnus-article-hide-pgp
       gnus-article-hide-pem gnus-article-hide-signature
       gnus-article-strip-leading-blank-lines gnus-article-date-local
--- lisp/gnus-sum.el.DIST	Tue Feb  5 10:58:24 2002
+++ lisp/gnus-sum.el	Fri Feb  8 09:06:45 2002
@@ -1729,6 +1729,7 @@
     "6" gnus-article-de-base64-unreadable
     "Z" gnus-article-decode-HZ
     "h" gnus-article-wash-html
+    "u" gnus-article-unsplit-urls
     "s" gnus-summary-force-verify-and-decrypt
     "f" gnus-article-display-x-face
     "l" gnus-summary-stop-page-breaking
@@ -1953,6 +1954,7 @@
 	      ["Unfold headers" gnus-article-treat-unfold-headers t]
 	      ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
 	      ["Html" gnus-article-wash-html t]
+	      ["URLs" gnus-article-unsplit-urls t]
 	      ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
 	      ["HZ" gnus-article-decode-HZ t])
 	     ("Output"
--- texi/gnus.texi.DIST	Tue Feb  5 10:58:24 2002
+++ texi/gnus.texi	Fri Feb  8 09:14:47 2002
@@ -8125,6 +8125,14 @@
 common encoding employed when sending Chinese articles.  It typically
 makes strings look like @samp{~@{<:Ky2;S@{#,NpJ)l6HK!#~@}}.
 
+@item W u
+@kindex W u (Summary)
+@findex gnus-article-unsplit-urls
+Remove newlines from within URLs.  Some mailers insert newlines into
+outgoing email messages to keep lines short.  This reformatting can
+split long URLs onto multiple lines.  Repair those URLs by removing
+the newlines (@code{gnus-article-unsplit-urls}).
+
 @item W h
 @kindex W h (Summary)
 @findex gnus-article-wash-html
@@ -10348,6 +10356,7 @@
 @item gnus-treat-strip-pem (t, last, integer)
 @item gnus-treat-strip-pgp (t, last, integer)
 @item gnus-treat-strip-trailing-blank-lines (t, last, integer)
+@item gnus-treat-unsplit-urls (t, integer)
 
 @xref{Article Washing}.
 

  parent reply	other threads:[~2002-02-08 14:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-04 14:58 gnus-article-unsplit-urls Michael Cook
2002-01-04 15:31 ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 15:38   ` gnus-article-unsplit-urls Michael Cook
2002-01-04 15:48     ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 16:37       ` gnus-article-unsplit-urls Lars Magne Ingebrigtsen
2002-01-04 17:27         ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 17:42           ` gnus-article-unsplit-urls Lars Magne Ingebrigtsen
2002-01-04 18:06             ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 15:44   ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 16:38     ` gnus-article-unsplit-urls Lars Magne Ingebrigtsen
2002-01-04 17:08       ` gnus-article-unsplit-urls Michael Cook
2002-01-04 17:12         ` gnus-article-unsplit-urls Lars Magne Ingebrigtsen
2002-01-04 17:33       ` gnus-article-unsplit-urls Simon Josefsson
2002-01-04 17:42         ` gnus-article-unsplit-urls Michael Cook
2002-02-08 14:19 ` Michael Cook [this message]
2002-02-08 14:33   ` gnus-article-unsplit-urls ShengHuo ZHU

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=g08heosnjiu.fsf@zzz.cisco.com \
    --to=michael.cook@cisco.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.
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).