From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/38423 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: message-subject-re Date: Wed, 29 Aug 2001 21:33:19 +0200 Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035174288 22309 80.91.224.250 (21 Oct 2002 04:24:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 04:24:48 +0000 (UTC) Return-Path: Return-Path: Original-Received: (qmail 8674 invoked from network); 29 Aug 2001 19:33:54 -0000 Original-Received: from dolk.extundo.com (195.42.214.242) by gnus.org with SMTP; 29 Aug 2001 19:33:54 -0000 Original-Received: from barbar.josefsson.org (slipsten.extundo.com [195.42.214.241]) (authenticated) by dolk.extundo.com (8.11.6/8.11.6) with ESMTP id f7TJY0h25375 for ; Wed, 29 Aug 2001 21:34:00 +0200 Original-To: ding@gnus.org In-Reply-To: (prj@po.cwru.edu's message of "Wed, 29 Aug 2001 14:48:25 -0400") User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.104 Mail-Copies-To: nobody Original-Lines: 110 Xref: main.gmane.org gmane.emacs.gnus.general:38423 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:38423 prj@po.cwru.edu (Paul Jarc) writes: > Michael.Cook@cisco.com wrote: > > prj@po.cwru.edu (Paul Jarc) writes: >>> Michael.Cook@cisco.com wrote: >>> > i wanted to inhibit gnus from inserting "Re:" at the beginning of >>>> subject lines. but it seems that that behavior is hard-coded into >>>> message.el. here's a patch to unharden that code. >>> >>> I'd like to see something more general. In particular, I'd like >>> "(was:.*" to be removed from the Subject: in responses. Maybe a hook >>> is in order? >> >> i think you might have misunderstood. message-subject-re is the >> string that gnus inserts into the subject line when you start >> composing a reply (or follow-up). > > I understand. I'd like to have a more general facility for modifying > the subject when composing a response. This could incorporate adding > "Re: " and removing a trailing "(was:.*". Maybe also remove > "Re\[[0-9]+\]:" or something. Inspired by `message-make-forward-subject-function': Index: message.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v retrieving revision 6.117 diff -u -u -w -u -w -r6.117 message.el --- message.el 2001/08/19 02:01:24 6.117 +++ message.el 2001/08/29 19:33:23 @@ -228,6 +228,29 @@ :group 'message-various :type 'regexp) +(defcustom message-subject-re "Re: " + "*The string to insert at the beginning of subject lines when replying." + :group 'message-various + :type 'string) + +(defcustom message-make-re-subject-function '(message-strip-list-identifiers + message-strip-subject-re + message-add-subject-re) + "*List of functions called to massage subject lines when replying. +The subject generated by the previous function is passed into each +successive function. + +The provided functions (which both are used by default) are: + +* `message-strip-list-identifiers' (Removes `gnus-list-identifiers'.) +* `message-strip-subject-re' (Removes `message-subject-re-regexp'.) +* `message-add-subject-re' (Prepends \"Re: \".) +" + :group 'message-various + :type '(radio (function-item message-strip-subject-re) + (function-item message-strip-list-identifiers) + (repeat :tag "List of functions" function))) + ;;;###autoload (defcustom message-signature-separator "^-- *$" "Regexp matching the signature separator." @@ -1291,6 +1314,25 @@ (substring subject (match-end 0)) subject)) +(defun message-add-subject-re (subject) + "Prepend \"Re:\" to SUBJECT." + (concat message-subject-re subject)) + +(defun message-make-re-subject (subject) + "Return a Subject header suitable for replying in the current buffer." + (let ((funcs message-make-re-subject-function)) + ;; Make sure funcs is a list. + (and funcs + (not (listp funcs)) + (setq funcs (list funcs))) + ;; Apply funcs in order, passing subject generated by previous + ;; func to the next one. + (while funcs + (when (message-functionp (car funcs)) + (setq subject (funcall (car funcs) subject))) + (setq funcs (cdr funcs))) + subject)) + (defun message-remove-header (header &optional is-regexp first reverse) "Remove HEADER in the narrowed buffer. If IS-REGEXP, HEADER is a regular expression. @@ -4179,10 +4221,7 @@ date (message-fetch-field "date") from (message-fetch-field "from") subject (or (message-fetch-field "subject") "none")) - (when gnus-list-identifiers - (setq subject (message-strip-list-identifiers subject))) - (setq subject (concat "Re: " (message-strip-subject-re subject))) - + (setq subject (message-make-re-subject subject)) (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) (string-match "<[^>]+>" gnus-warning)) (setq message-id (match-string 0 gnus-warning))) @@ -4255,9 +4294,7 @@ (let ((case-fold-search t)) (string-match "world" distribution))) (setq distribution nil)) - (if gnus-list-identifiers - (setq subject (message-strip-list-identifiers subject))) - (setq subject (concat "Re: " (message-strip-subject-re subject))) + (setq subject (message-make-re-subject subject)) (widen)) (message-pop-to-buffer (message-buffer-name "followup" from newsgroups))