From: yamaoka Date: Mon, 12 Jan 2004 03:15:59 +0000 (+0000) Subject: Synch to No Gnus 200401120307. X-Git-Tag: t-gnus-6_17_4-quimby-~1142 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3907af0cde5efb27d4ee683898a0a6181ea352b8;p=elisp%2Fgnus.git- Synch to No Gnus 200401120307. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b0d0850..99042af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2004-01-12 Jesper Harder + + * rfc2047.el (rfc2047-decode-string): Don't cons a string + unnecessarily. + + * mm-util.el (mm-replace-chars-in-string): Remove. + + * rfc2047.el (rfc2047-decode): Use mm-subst-char-in-string instead + of mm-replace-chars-in-string. + +2004-01-11 Jesper Harder + + * gnus.sum.el (gnus-remove-odd-characters): Don't cons two new + strings. + + * mm-util.el (mm-subst-char-in-string): Support inplace. + + * gnus-sum.el (gnus-summary-remove-list-identifiers): Don't cons + a new string in every iteration. Use shy groups. + 2004-01-10 Jesper Harder * gnus-start.el (gnus-subscribe-newsgroup, gnus-start-draft-setup) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 0d538b6..05cd32d 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -3989,8 +3989,7 @@ Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise." "Translate STRING into something that doesn't contain weird characters." (mm-subst-char-in-string ?\r ?\- - (mm-subst-char-in-string - ?\n ?\- string))) + (mm-subst-char-in-string ?\n ?\- string t) t)) ;; This function has to be called with point after the article number ;; on the beginning of the line. @@ -4960,23 +4959,20 @@ or a straight list of headers." gnus-list-identifiers)) changed subject) (when regexp + (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)")) (dolist (header gnus-newsgroup-headers) (setq subject (mail-header-subject header) changed nil) - (while (string-match - (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)") - subject) + (while (string-match regexp subject) (setq subject - (concat (substring subject 0 (match-beginning 2)) + (concat (substring subject 0 (match-beginning 1)) (substring subject (match-end 0))) changed t)) - (when (and changed - (string-match - "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject)) - (setq subject - (concat (substring subject 0 (match-beginning 1)) - (substring subject (match-end 1))))) (when changed + (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject) + (setq subject + (concat (substring subject 0 (match-beginning 1)) + (substring subject (match-end 1))))) (mail-header-set-subject header subject)))))) (defun gnus-fetch-headers (articles) diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 16cb2d7..e41f477 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -57,9 +57,10 @@ mm-mime-mule-charset-alist) nil t)))) (subst-char-in-string - . (lambda (from to string) ;; stolen (and renamed) from nnheader.el - "Replace characters in STRING from FROM to TO." - (let ((string (substring string 0)) ;Copy string. + . (lambda (from to string &optional inplace) ;; stolen (and renamed) from nnheader.el + "Replace characters in STRING from FROM to TO. + Unless optional argument INPLACE is non-nil, return a new string." + (let ((string (if inplace string (copy-sequence string))) (len (length string)) (idx 0)) ;; Replace all occurrences of FROM with TO. @@ -398,9 +399,6 @@ used as the line break code type of the coding system." (setq cs c))) cs)))) -(defsubst mm-replace-chars-in-string (string from to) - (mm-subst-char-in-string from to string)) - (eval-and-compile (defvar mm-emacs-mule (and (not (featurep 'xemacs)) (boundp 'default-enable-multibyte-characters) diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index 17493af..6b8343c 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -668,7 +668,20 @@ By default, the region is treated as containing addresses (see mail-parse-charset (not (eq mail-parse-charset 'us-ascii)) (not (eq mail-parse-charset 'gnus-decoded))) - (mm-decode-coding-string string mail-parse-charset) + ;; `decode-coding-string' in Emacs offers a third optional + ;; arg NOCOPY to avoid consing a new string if the decoding + ;; is "trivial". Unfortunately it currently doesn't + ;; consider anything else than a `nil' coding system + ;; trivial. + ;; `rfc2047-decode-string' is called multiple times for each + ;; article during summary buffer generation, and we really + ;; want to avoid unnecessary consing. So we bypass + ;; `decode-coding-string' if the string is purely ASCII. + (if (and (fboundp 'detect-coding-string) + ;; string is purely ASCII + (eq (detect-coding-string string t) 'undecided)) + string + (mm-decode-coding-string string mail-parse-charset)) (mm-string-as-multibyte string))))) (defun rfc2047-parse-and-decode (word) @@ -724,7 +737,7 @@ If your Emacs implementation can't decode CHARSET, return nil." (rfc2047-pad-base64 string))) ((equal "Q" encoding) (quoted-printable-decode-string - (mm-replace-chars-in-string string ?_ ? ))) + (mm-subst-char-in-string ?_ ? string t))) (t (error "Invalid encoding: %s" encoding))) cs))))