Gnus development mailing list
 help / color / mirror / Atom feed
* Eliminating repetitious "Re: Re: Re: ..."
@ 2001-01-31 14:31 Karl Kleinpaste
  2001-01-31 15:41 ` Oyvind Moll
  2001-01-31 18:07 ` ShengHuo ZHU
  0 siblings, 2 replies; 6+ messages in thread
From: Karl Kleinpaste @ 2001-01-31 14:31 UTC (permalink / raw)


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

I want to repair this damage done to Subject lines, notably in mailing
lists which have standard tokens in them.

For example, and as I'm sure everyone knows, you get a mailing list
which automatically prepends "[foo]" to every subject line if it is
not already present:
    Subject: [foo] the original subject
Normal followups to this, in the absence of other hackery, become:
    Subject: Re: [foo] the original subject
Egroups and related list-support sites will leave this one alone,
because the needed "[foo]" token is in place.  But then we Gnusers
come along, knowing that we don't need no steenkin' subject tokens,
and so we strip them out:
    (setq nnmail-list-identifiers '("\\[foo]"))
so that what we see is:
    Subject: the original subject
and when we reply, we generate:
    Subject: Re: the original subject
List handlers decide this is inadequate, so they re-append the token:
    Subject: [foo] Re: the original subject
and then some non-Gnuser follows up, generating
    Subject: Re: [foo] Re: the original subject
which the list-identifier-stripping Gnuser will subsequently see as:
    Subject: Re: Re: the original subject

The patch below addresses this during nnmail-list-identifiers
processing, detecting repeated occurrence of "Re: " and reducing it to
just one.

--karl

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnmail.el diff, removing excess \"Re: \" --]
[-- Type: text/x-patch, Size: 690 bytes --]

--- lisp/nnmail.el.~1~	Tue Jan 23 09:12:11 2001
+++ lisp/nnmail.el	Wed Jan 31 09:30:30 2001
@@ -1097,9 +1097,12 @@
     (when regexp
       (goto-char (point-min))
       (when (re-search-forward
-	     (concat "^Subject: +\\(Re: +\\)?\\(" regexp " *\\)")
+	     (concat "^Subject: +\\(R[Ee]: +\\)?\\(" regexp " *\\)")
 	     nil t)
-	(delete-region (match-beginning 2) (match-end 0))))))
+	(delete-region (match-beginning 2) (match-end 0)))
+      (goto-char (point-min))
+      (when (re-search-forward "^Subject: +\\(R[Ee]: +\\)+R[Ee]: +" nil t)
+	(delete-region (match-beginning 1) (match-end 1))))))
 
 (defun nnmail-remove-tabs ()
   "Translate TAB characters into SPACE characters."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Eliminating repetitious "Re: Re: Re: ..."
  2001-01-31 14:31 Eliminating repetitious "Re: Re: Re: ..." Karl Kleinpaste
@ 2001-01-31 15:41 ` Oyvind Moll
  2001-01-31 18:07 ` ShengHuo ZHU
  1 sibling, 0 replies; 6+ messages in thread
From: Oyvind Moll @ 2001-01-31 15:41 UTC (permalink / raw)


* Karl Kleinpaste <karl@charcoal.com>
|
| I want to repair this damage done to Subject lines, notably in mailing
| lists which have standard tokens in them.

[A small digression:]


At least one MUA I know uses a number in parantheses to indicate the
"depth", like this:

Subject: Re(4): Eliminating repetitious "Re: Re: Re: ..."


Fun experiment: Send a mail with a subject like this:

Subject: Re(2147483647): Foo bar

When a person with the standardly challenged MUA replies, the subject
will be:

Subject: Re(-2147483648): Foo bar

Look, mommy!  A signed 32-bit thingie!


--
   Øyvind Møll              <oyvindmo@initio.no>
   Initio IT-løsninger AS   <URL: http://www.initio.no/ >



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Eliminating repetitious "Re: Re: Re: ..."
  2001-01-31 14:31 Eliminating repetitious "Re: Re: Re: ..." Karl Kleinpaste
  2001-01-31 15:41 ` Oyvind Moll
@ 2001-01-31 18:07 ` ShengHuo ZHU
  2001-01-31 19:57   ` Karl Kleinpaste
  2001-02-02 21:22   ` Paul Jarc
  1 sibling, 2 replies; 6+ messages in thread
From: ShengHuo ZHU @ 2001-01-31 18:07 UTC (permalink / raw)


Karl Kleinpaste <karl@charcoal.com> writes:

> I want to repair this damage done to Subject lines, notably in mailing
> lists which have standard tokens in them.
> 
> For example, and as I'm sure everyone knows, you get a mailing list
> which automatically prepends "[foo]" to every subject line if it is
> not already present:
>     Subject: [foo] the original subject
> Normal followups to this, in the absence of other hackery, become:
>     Subject: Re: [foo] the original subject
> Egroups and related list-support sites will leave this one alone,
> because the needed "[foo]" token is in place.  But then we Gnusers
> come along, knowing that we don't need no steenkin' subject tokens,
> and so we strip them out:
>     (setq nnmail-list-identifiers '("\\[foo]"))
> so that what we see is:
>     Subject: the original subject
> and when we reply, we generate:
>     Subject: Re: the original subject
> List handlers decide this is inadequate, so they re-append the token:
>     Subject: [foo] Re: the original subject
> and then some non-Gnuser follows up, generating
>     Subject: Re: [foo] Re: the original subject
> which the list-identifier-stripping Gnuser will subsequently see as:
>     Subject: Re: Re: the original subject
> 
> The patch below addresses this during nnmail-list-identifiers
> processing, detecting repeated occurrence of "Re: " and reducing it to
> just one.

What if the header is
     Subject: [foo] Re: [foo] Re: [foo] Re: the original subject

Actually, article-hide-list-identifier and
gnus-summary-remove-list-identifiers have done this, but the
limitation is that \( and \) can not be included list-identifiers.
Could you find a better solution for all of these functions?

ShengHuo

-- 
(setq gnus-posting-styles '((".*" (signature-file "~/.signature"))))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Eliminating repetitious "Re: Re: Re: ..."
  2001-01-31 18:07 ` ShengHuo ZHU
@ 2001-01-31 19:57   ` Karl Kleinpaste
  2001-01-31 20:55     ` ShengHuo ZHU
  2001-02-02 21:22   ` Paul Jarc
  1 sibling, 1 reply; 6+ messages in thread
From: Karl Kleinpaste @ 2001-01-31 19:57 UTC (permalink / raw)


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

ShengHuo ZHU <zsh@cs.rochester.edu> writes:
> What if the header is
>      Subject: [foo] Re: [foo] Re: [foo] Re: the original subject

Then the identifiers should be removed one at a time.

Below is a new patch (from original source) which loops until no more
identifiers are present, and then eliminates excess "Re: ".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: updated nnmail Re: patch --]
[-- Type: text/x-patch, Size: 856 bytes --]

--- lisp/nnmail.el.~1~	Tue Jan 23 09:12:11 2001
+++ lisp/nnmail.el	Wed Jan 31 14:09:26 2001
@@ -1096,10 +1096,14 @@
 		  (mapconcat 'identity nnmail-list-identifiers " *\\|"))))
     (when regexp
       (goto-char (point-min))
-      (when (re-search-forward
-	     (concat "^Subject: +\\(Re: +\\)?\\(" regexp " *\\)")
-	     nil t)
-	(delete-region (match-beginning 2) (match-end 0))))))
+      (while (re-search-forward
+              (concat "^Subject: +\\(R[Ee]: +\\)*\\(" regexp " *\\)")
+              nil t)
+        (delete-region (match-beginning 2) (match-end 0))
+        (beginning-of-line))
+      (when (re-search-forward "^Subject: +\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" nil t)
+        (delete-region (match-beginning 1) (match-end 1))
+	(beginning-of-line)))))
 
 (defun nnmail-remove-tabs ()
   "Translate TAB characters into SPACE characters."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Eliminating repetitious "Re: Re: Re: ..."
  2001-01-31 19:57   ` Karl Kleinpaste
@ 2001-01-31 20:55     ` ShengHuo ZHU
  0 siblings, 0 replies; 6+ messages in thread
From: ShengHuo ZHU @ 2001-01-31 20:55 UTC (permalink / raw)


Karl Kleinpaste <karl@charcoal.com> writes:

> ShengHuo ZHU <zsh@cs.rochester.edu> writes:
> > What if the header is
> >      Subject: [foo] Re: [foo] Re: [foo] Re: the original subject
> 
> Then the identifiers should be removed one at a time.
> 
> Below is a new patch (from original source) which loops until no more
> identifiers are present, and then eliminates excess "Re: ".

Committed. Thanks. I also changed the other two functions.

ShengHuo

-- 
(setq gnus-posting-styles '((".*" (signature-file "~/.signature"))))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Eliminating repetitious "Re: Re: Re: ..."
  2001-01-31 18:07 ` ShengHuo ZHU
  2001-01-31 19:57   ` Karl Kleinpaste
@ 2001-02-02 21:22   ` Paul Jarc
  1 sibling, 0 replies; 6+ messages in thread
From: Paul Jarc @ 2001-02-02 21:22 UTC (permalink / raw)


I've thought of adding something like the following to nnmaildir,
although it really belongs in Gnus proper, not in backends: I look at
a group/topic paramter called, say, canonicalize-subject.  Its value
is a function.  I call that function, giving it the actual subject as
an argument.  It returns a canonicalized subject.  I use the
canonicalized subject for NOV data, but leave the original article
unmodified.

Some useful default things that could be done to the subject:
- remove "\`\(Re:|[blah]| *\)*"
- remove "(was: .*\'"
- replace " +" with " "
It looks like a hook might be more appropriate, but then the
individual functions would all have to look at a variable instead of
their arguments, and set the variable instead of return the new
subject.  Or else the functions would have to be called by a helper
function, instead of in the usual hook fashion.

The article itself should not be modified.  The canonicalized subject
should be used for thread gathering, display in the Summary buffer,
constructing replies, and maybe even article display (but not for
C-u g, of course).  If I do this in my backend by canonicalizing the
NOV subject, I'd be able to hit some of these areas, but not all.


paul



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-02-02 21:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-31 14:31 Eliminating repetitious "Re: Re: Re: ..." Karl Kleinpaste
2001-01-31 15:41 ` Oyvind Moll
2001-01-31 18:07 ` ShengHuo ZHU
2001-01-31 19:57   ` Karl Kleinpaste
2001-01-31 20:55     ` ShengHuo ZHU
2001-02-02 21:22   ` Paul Jarc

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).