Gnus development mailing list
 help / color / mirror / Atom feed
* Integrating message-utils.el into Gnus?
@ 2001-04-27 20:48 Matthias Wiehl
  2001-04-28  1:34 ` Toby Speight
  2002-02-14  0:17 ` Reiner Steib
  0 siblings, 2 replies; 4+ messages in thread
From: Matthias Wiehl @ 2001-04-27 20:48 UTC (permalink / raw)


At <http://www.coling.uni-freiburg.de/~schauer/emacs.html>, Holger
Schauer [1] provides a file called message-utils.el [2].  It contains
a few complementary functions for use with Gnus' message-mode.

Personally, I find three of those functions extraordinarily useful:

  o  `message-change-subject' asks for a new subject, and modifies the
     message's Subject header in a way that is RFC 1036bis compliant:
     `new subject (was: old subject)'.

  o  `message-strip-subject-was' can be hooked into
     `message-header-setup-hook'.  It strips `(was: old subject)' from
     the Subject header (which is what user agents are supposed to do)
     as far as I know) when entering message-mode.  Both slrn and tin
     do this out-of-the-box.

  o  `message-xpost-fup2' asks for a newsgroup name (providing
     tab-completion via gnus-newsrc-alist).  This name is then
     appended to the Newsgroups header, and the Followup-To header
     is modified to contain only the given newsgroup name as its
     value.  Furthermore, a customizable note is inserted in the
     message body, saying that a Followup-To header has been set.

Is there any chance of integrating these functions into the standard
Gnus distribution?

-------
[1] <mailto:Holger.Schauer@gmx.de>
[2] <http://www.coling.uni-freiburg.de/~schauer/resources/emacs/message-utils.el.gz>


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

* Re: Integrating message-utils.el into Gnus?
  2001-04-27 20:48 Integrating message-utils.el into Gnus? Matthias Wiehl
@ 2001-04-28  1:34 ` Toby Speight
  2002-02-14  0:17 ` Reiner Steib
  1 sibling, 0 replies; 4+ messages in thread
From: Toby Speight @ 2001-04-28  1:34 UTC (permalink / raw)


0> In article <874rval15a.fsf@fulmine.dhs.org>,
0> Matthias Wiehl <URL:mailto:mwiehl@gmx.de> ("Matthias") wrote:

Matthias> Holger Schauer [1] provides a file called message-utils.el
Matthias> [2].  It contains a few complementary functions for use with
Matthias> Gnus' message-mode.
Matthias>
Matthias> [1] <URL:mailto:Holger.Schauer@gmx.de>
Matthias> [2] <URL:http://www.coling.uni-freiburg.de/%7eschauer/resources/emacs/message-utils.el.gz>
Matthias>
Matthias>
Matthias> Personally, I find three of those functions extraordinarily
Matthias> useful:
Matthias>
Matthias>   o  `message-change-subject' asks for a new subject, and
Matthias>      modifies the message's Subject header in a way that is
Matthias>      RFC 1036bis compliant: `new subject (was: old subject)'.
Matthias>
Matthias>   o  `message-strip-subject-was' can be hooked into
Matthias>      `message-header-setup-hook'.  It strips `(was: old
Matthias>      subject)' from the Subject header (which is what user
Matthias>      agents are supposed to do) as far as I know) when
Matthias>      entering message-mode.  Both slrn and tin do this
Matthias>      out-of-the-box.

I've posted my equivalent here before - perhaps someone has the time
to compare the two and combine the best bits of each?


Matthias>   o  `message-xpost-fup2' asks for a newsgroup name (providing
Matthias>      tab-completion via gnus-newsrc-alist).  This name is then
Matthias>      appended to the Newsgroups header, and the Followup-To
Matthias>      header is modified to contain only the given newsgroup
Matthias>      name as its value.  Furthermore, a customizable note is
Matthias>      inserted in the message body, saying that a Followup-To
Matthias>      header has been set.

I haven't written anything to do that - sounds cool.

Here's my code:

  -- snip here --

(defvar message-change-subject-ignored-prefixes
  "\\`\\(\\(Re\\|Fwd\\|AW\\)\\>[.:]?\\|\\[[^][]+\\]\\|[ \t\r]+\\)"
  "Regexp matching things to be stripped when following up.")

(defun message-change-subject-interactively (&optional new-subj) ;gnus-subject-interactive
  "Change the Subject, bracketing with \"(was...)\" if necessary."
  (interactive "*")
  (undo-boundary)
  (save-excursion
    (save-restriction
      (message-narrow-to-headers-or-head)
      (let* ((subject (message-fetch-field "Subject"))
             (case-fold-search t))
        (if (null subject)
            (setq new-subj (read-from-minibuffer "New Subject: "))
          ;; There was already a subject
          (when (string-match "\\s-+\\'" subject) ; remove trailing spaces
            (setq subject (replace-match "" t t subject)))
          (if (and (not new-subj) (string-match "^[Rr][Ee]\\>" subject))
              ;; only ask if it wasn't our subject
              (setq new-subj
                    (read-from-minibuffer (concat "New Subject: (was " subject ") "))))
          ;; new-subj is nil if we already have an original subject (not starting with "Re:")
          ;; It is a string if we are following-up (so might want to remove "(was ...)")
          (if (and new-subj
                   (or                  ;(re-search-forward "\\s-*\\((was\\>.*\\)" subject-end t)
                    (string-match "\\s-*\\([[(,;]\\s-*was\\>.*\\)" subject)
                    (string-match "\\s-*\\<\\(was:?\\s-+[Rr][Ee]:.*\\)" subject)
                    (string-match "\\s-*[[(,;]\\s-*\\([Rr][Ee]:.*\\)" subject))
                   (or (not (string= new-subj "")) ; if replacing, force removal
                       (y-or-n-p (concat "Remove \"" (match-string 1 subject) "\" from Subject: line? "))))
              (setq new-subj (replace-match "" t t subject)
                    subject nil))
          (if (or (null new-subj) (string= "" new-subj))
              ;; No true change in subject
              (setq new-subj subject
                    subject nil)
            ;;  User changed the subject
            ;; first undo RFC-822 line-wrap
            (while (and subject (string-match "\n[ \t]" subject))
              (setq subject (replace-match " " t t subject)))
            ;; might be a followup to a forwarded message, so trim [...] too
            (while (and subject (string-match message-change-subject-ignored-prefixes subject))
              (setq subject (replace-match "" t t subject)))
            ;; Trim subject line to 75 chars (leaving room for a recipient to add "Re: ")
            ;; "Subject: "(9) + new-subj + "(was: "(6) + subject + "...)"(1 or 4)  <=75
            ;; means subject<=(59 - new-subj) or trim to (56 - new-subj)
            (if (and subject (> (length subject) (- 59 (length new-subj))))
                (let ((maxlen (- 56 (length new-subj))))
                  (if (<= maxlen 0)
                      (setq subject "...")
                    ;; keep one extra char, so we know if last char is a word-boundary
                    (setq subject (substring subject 0 (1+ maxlen)))
                    (if (string-match "\\s-*\\(\\B.\\|\\<.\\)*\\'" subject)
                        (setq subject (replace-match "..." t t subject))))))))
        (widen)
        (when new-subj
          (if (and subject (not (string= "" subject)))
              (setq new-subj (concat new-subj " (was: " subject ")")))
          (message-goto-subject)
          (message-delete-line)
          (insert "Subject: " new-subj "\n"))))))

  -- snip here --

It's suitable for use in `message-send-hook' (that's how I use it), in
which case it asks you to confirm the subject if you've not obviously
edited it from the existing value.  If you change it, it removes any
(was...)  string and replaces it with one made from the old subject.
It attempts to truncate the new (was...)  string to fit an 80-column
screen, preferably at word boundaries.

If you leave the subject unchanged, and there was a "(was...)" section
if offers (y-or-n-p) to remove it for you.



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

* Re: Integrating message-utils.el into Gnus?
  2001-04-27 20:48 Integrating message-utils.el into Gnus? Matthias Wiehl
  2001-04-28  1:34 ` Toby Speight
@ 2002-02-14  0:17 ` Reiner Steib
  2002-02-14  1:04   ` ShengHuo ZHU
  1 sibling, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2002-02-14  0:17 UTC (permalink / raw)


On Fri, Apr 27 2001, Matthias Wiehl wrote:

[Full quote, because cited message is quite old]

> At <http://www.coling.uni-freiburg.de/~schauer/emacs.html>, Holger
> Schauer [1] provides a file called message-utils.el [2].  It contains
> a few complementary functions for use with Gnus' message-mode.
>
> Personally, I find three of those functions extraordinarily useful:
>
>   o  `message-change-subject' asks for a new subject, and modifies the
>      message's Subject header in a way that is RFC 1036bis compliant:
>      `new subject (was: old subject)'.
>
>   o  `message-strip-subject-was' can be hooked into
>      `message-header-setup-hook'.  It strips `(was: old subject)' from
>      the Subject header (which is what user agents are supposed to do)
>      as far as I know) when entering message-mode.  Both slrn and tin
>      do this out-of-the-box.
>
>   o  `message-xpost-fup2' asks for a newsgroup name (providing
>      tab-completion via gnus-newsrc-alist).  This name is then
>      appended to the Newsgroups header, and the Followup-To header
>      is modified to contain only the given newsgroup name as its
>      value.  Furthermore, a customizable note is inserted in the
>      message body, saying that a Followup-To header has been set.
>
> Is there any chance of integrating these functions into the standard
> Gnus distribution?
>
> -------
> [1] <mailto:Holger.Schauer@gmx.de>
> [2] <http://www.coling.uni-freiburg.de/~schauer/resources/emacs/message-utils.el.gz>

`message-change-subject' and `message-strip-subject-was' are features
that are requested quite often (and the usual answer is `Gnus +
message-utils.el'). WIBNI Gnus would support this out of the box?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/



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

* Re: Integrating message-utils.el into Gnus?
  2002-02-14  0:17 ` Reiner Steib
@ 2002-02-14  1:04   ` ShengHuo ZHU
  0 siblings, 0 replies; 4+ messages in thread
From: ShengHuo ZHU @ 2002-02-14  1:04 UTC (permalink / raw)


Reiner Steib <4uce.02.r.steib@gmx.net> writes:

> On Fri, Apr 27 2001, Matthias Wiehl wrote:
>
> [Full quote, because cited message is quite old]
>
>> At <http://www.coling.uni-freiburg.de/~schauer/emacs.html>, Holger
>> Schauer [1] provides a file called message-utils.el [2].  It contains
>> a few complementary functions for use with Gnus' message-mode.
>>
>> Personally, I find three of those functions extraordinarily useful:
>>
>>   o  `message-change-subject' asks for a new subject, and modifies the
>>      message's Subject header in a way that is RFC 1036bis compliant:
>>      `new subject (was: old subject)'.
>>
>>   o  `message-strip-subject-was' can be hooked into
>>      `message-header-setup-hook'.  It strips `(was: old subject)' from
>>      the Subject header (which is what user agents are supposed to do)
>>      as far as I know) when entering message-mode.  Both slrn and tin
>>      do this out-of-the-box.
>>
>>   o  `message-xpost-fup2' asks for a newsgroup name (providing
>>      tab-completion via gnus-newsrc-alist).  This name is then
>>      appended to the Newsgroups header, and the Followup-To header
>>      is modified to contain only the given newsgroup name as its
>>      value.  Furthermore, a customizable note is inserted in the
>>      message body, saying that a Followup-To header has been set.
>>
>> Is there any chance of integrating these functions into the standard
>> Gnus distribution?
>>
>> -------
>> [1] <mailto:Holger.Schauer@gmx.de>
>> [2] <http://www.coling.uni-freiburg.de/~schauer/resources/emacs/message-utils.el.gz>
>
> `message-change-subject' and `message-strip-subject-was' are features
> that are requested quite often (and the usual answer is `Gnus +
> message-utils.el'). WIBNI Gnus would support this out of the box?

If Holger agrees to sign the FSF assignment, I can integrate it into
the future Gnus distribution.  I've sent him the request form.

ShengHuo



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

end of thread, other threads:[~2002-02-14  1:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-27 20:48 Integrating message-utils.el into Gnus? Matthias Wiehl
2001-04-28  1:34 ` Toby Speight
2002-02-14  0:17 ` Reiner Steib
2002-02-14  1:04   ` ShengHuo ZHU

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