From 5a56be26468ed06f649a62cac66805846a185131 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 19 Mar 1998 10:30:55 +0000 Subject: [PATCH] (message-make-subject): New function. (message-subject-prefix-regexp): New variable. (message-subject-dont-modify-regexp): New variable. --- lisp/message.el | 55 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/lisp/message.el b/lisp/message.el index 79b3367..5db1f9f 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1159,6 +1159,49 @@ Return the number of headers removed." (1+ max))))) (message-sort-headers-1)))) +(defvar message-subject-dont-modify-regexp nil + "If non-nil and this regexp matches subject, +use identical subject.") +(setq message-subject-dont-modify-regexp-always-match "") +(setq message-subject-dont-modify-regexp-encoded-re + (concat + "^[ \t]*" + (regexp-quote "=?") + mime-charset-regexp ; from semi/mime-def.el + (regexp-quote "?") + "\\(" + "[Bb]" (regexp-quote "?") + "\\(\\(CQk\\|CSA\\|IAk\\|ICA\\)[Jg]\\)*" ; \([ \t][ \t][ \t]\)* + "\\(" + "[Uc][km]U6" ; [Rr][Ee]: + "\\|" + "\\(C[VX]\\|I[FH]\\)J[Fl]O[g-v]" ; [ \t][Rr][Ee]: + "\\|" + "\\(CQl\\|CSB\\|IAl\\|ICB\\)[Sy][RZ]T[o-r]" ; [ \t][ \t][Rr][Ee]: + "\\)" + "\\|" + "[Qb]" (regexp-quote "?") + "\\(_\\|=09\\|=20\\)*" + "\\([Rr]\\|=[57]2\\)\\([Ee]\\|=[46]5\\)\\(:\\|=3[Aa]\\)" + "\\)" + )) + +(defvar message-subject-prefix-regexp "^[ \t]*[Rr][Ee]:[ \t]*" + "regexp that matches (maybe buggy) Re:") + +(defun message-make-subject (subject) + (cond + ;; If unremovable buggy Re: is found, do not attach additional Re:. + ((and message-subject-dont-modify-regexp + (string-match message-subject-dont-modify-regexp subject)) + subject) + ;; Remove any (buggy) Re:'s that are present and make a + ;; proper one. + ((string-match message-subject-prefix-regexp subject) + (concat "Re: " (substring subject (match-end 0)))) + (t + (concat "Re: " subject)))) + ;;; @@ -3372,11 +3415,7 @@ Headers already prepared in the buffer are not modified." reply-to (unless ignore-reply-to (message-fetch-field "reply-to")) references (message-fetch-field "references") message-id (message-fetch-field "message-id" t)) - ;; Remove any (buggy) Re:'s that are present and make a - ;; proper one. - (when (string-match "^[ \t]*[Rr][Ee]:[ \t]*" subject) - (setq subject (substring subject (match-end 0)))) - (setq subject (concat "Re: " subject)) + (setq subject (message-make-subject subject)) (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) (string-match "<[^>]+>" gnus-warning)) @@ -3493,11 +3532,7 @@ If TO-NEWSGROUPS, use that as the new Newsgroups line." (let ((case-fold-search t)) (string-match "world" distribution))) (setq distribution nil)) - ;; Remove any (buggy) Re:'s that are present and make a - ;; proper one. - (when (string-match "^[ \t]*[Rr][Ee]:[ \t]*" subject) - (setq subject (substring subject (match-end 0)))) - (setq subject (concat "Re: " subject)) + (setq subject (message-make-subject subject)) (widen)) (message-pop-to-buffer (message-buffer-name "followup" from newsgroups)) -- 1.7.10.4