From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/42999 Path: main.gmane.org!not-for-mail From: Michael Cook Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus-article-unsplit-urls Date: Fri, 08 Feb 2002 09:19:21 -0500 Organization: http://waxrat.com Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035178161 15188 80.91.224.250 (21 Oct 2002 05:29:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 05:29:21 +0000 (UTC) Return-Path: Original-Received: (qmail 28751 invoked from network); 8 Feb 2002 14:20:43 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 8 Feb 2002 14:20:43 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16ZBsm-0005GI-00; Fri, 08 Feb 2002 08:20:08 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 08 Feb 2002 08:20:05 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id IAA17135 for ; Fri, 8 Feb 2002 08:19:52 -0600 (CST) Original-Received: (qmail 28739 invoked by alias); 8 Feb 2002 14:19:49 -0000 Original-Received: (qmail 28734 invoked from network); 8 Feb 2002 14:19:49 -0000 Original-Received: from funnel.cisco.com (161.44.168.79) by gnus.org with SMTP; 8 Feb 2002 14:19:49 -0000 Original-Received: from spamsicle.cisco.com (mirapoint@spamsicle.cisco.com [161.44.172.225]) by funnel.cisco.com (8.8.5-Cisco.1/8.6.5) with ESMTP id JAA14219 for ; Fri, 8 Feb 2002 09:19:22 -0500 (EST) Original-Received: from zzz.cisco.com (zzz.cisco.com [10.89.5.93]) by spamsicle.cisco.com (Mirapoint) with ESMTP id AAD34914; Fri, 8 Feb 2002 09:19:22 -0500 (EST) Original-Received: (from zzz@localhost) by zzz.cisco.com (8.11.6/8.11.6) id g18EJLf29987; Fri, 8 Feb 2002 09:19:21 -0500 Original-To: ding@gnus.org X-Face: (::$,F}2XQ8GxBqsXCX?#09yY8mkcV?KEWi->CVJP*t3$PVv?E?;Fk34-6ppt@j'g?kWY_[ d:Xe(0a{$'N_Pv>/P&%U'\V`vimMH`er!2Z&*I]s-MWnUH]Ck+.D!"u`\LtI~'`N@I:o$a (Michael Cook's message of "Fri, 04 Jan 2002 09:58:54 -0500") Original-Lines: 10 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i686-pc-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:42999 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:42999 --=-=-= Michael Cook 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? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=unsplit-urls.patch --- 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}. --=-=-=--