* lisp/gnus-sum.el (message-subject-guess-encoded-re-regexp): New
authorakr <akr>
Mon, 23 Mar 1998 11:54:17 +0000 (11:54 +0000)
committerakr <akr>
Mon, 23 Mar 1998 11:54:17 +0000 (11:54 +0000)
constant.
(message-subject-dont-modify-regexp): Delete.
(message-subject-dont-modify-regexp-always-match): Delete.
(message-subject-dont-modify-regexp-encoded-re): Delete.
(message-followup-subject): New custom variable.
(message-make-subject): Use `message-followup-subject' instead of
`message-subject-dont-modify-regexp'.

lisp/message.el

index 5db1f9f..840b1df 100644 (file)
@@ -1159,48 +1159,58 @@ 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
+(defconst message-subject-guess-encoded-re-regexp
   (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]\\)"
-    "\\)"
-    ))
+   "^[ \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]\\)"
+   "\\)"
+   ))
+
+(defcustom message-followup-subject nil
+  "*If non-nil and this regexp matches subject,
+use identical subject.
+
+If the value is symbol, use its symbol-value."
+  :group 'message-various
+  :type '(choice (const :tag "Prepend Re: unless already has" nil)
+                (const :tag "Never prepend Re:" "")
+                (const :tag "Guess encoded Re:"
+                       message-subject-guess-encoded-re-regexp)))
 
 (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))))
+  (let ((message-followup-subject (if (symbolp message-followup-subject)
+                                     (symbol-value message-followup-subject)
+                                     message-followup-subject)))
+    (cond
+      ;; If unremovable buggy Re: is found, do not prepend additional Re:.
+     ((and message-followup-subject
+          (string-match message-followup-subject 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)))))
 
 \f