From c05e3e444215a3f6eeedfb48b00e0b1fd8fb76dd Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 28 Apr 1998 11:42:43 +0000 Subject: [PATCH] * lisp/gnus-i18n.el (gnus-set-summary-default-charset): Delete buffer-local binding of `default-mime-charset' when the newsgroup doesn't match `gnus-newsgroup-default-charset-alist'. * lisp/message.el (message-subject-guess-encoded-re-regexp): New constant. (message-followup-subject): New custom variable. (message-subject-prefix-regexp): New variable. (message-make-subject): New function. (message-reply): Use `message-make-subject'. (message-followup): Use `message-make-subject'. --- lisp/gnus-i18n.el | 16 ++++++------- lisp/message.el | 65 ++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/lisp/gnus-i18n.el b/lisp/gnus-i18n.el index 3737fb9..5126a0a 100644 --- a/lisp/gnus-i18n.el +++ b/lisp/gnus-i18n.el @@ -76,15 +76,15 @@ It is specified by variable `gnus-newsgroup-default-charset-alist' )) (setq alist (cdr alist))) )))) - (when charset - (save-excursion - (set-buffer gnus-summary-buffer) + (if charset + (progn + (save-excursion + (set-buffer gnus-summary-buffer) + (make-local-variable 'default-mime-charset) + (setq default-mime-charset charset)) (make-local-variable 'default-mime-charset) - (setq default-mime-charset charset) - ) - (make-local-variable 'default-mime-charset) - (setq default-mime-charset charset) - )))) + (setq default-mime-charset charset)) + (kill-local-variable 'default-mime-charset))))) ;;; @ end diff --git a/lisp/message.el b/lisp/message.el index 9605ff5..742ebde 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1164,6 +1164,59 @@ Return the number of headers removed." (1+ max))))) (message-sort-headers-1)))) +(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]\\)" + "\\)" + )) + +(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) + (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))))) + ;;; @@ -3390,11 +3443,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)) @@ -3511,11 +3560,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