From 16af24e27e41debd4aaa3b1f8d392e9ed174b724 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 7 Dec 2001 00:00:50 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 10 ++++++++++ lisp/gnus-util.el | 24 +++++++++++++++++------- lisp/nnrss.el | 7 +------ lisp/nnweb.el | 5 ----- lisp/nnwfm.el | 6 +++--- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 48efae9..daf23cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2001-12-06 10:00:00 ShengHuo ZHU + + * nnweb.el (nnweb-replace-in-string): Removed. + + * gnus-util.el (gnus-replace-in-string): New. + (gnus-mode-string-quote): Use it. + + * nnrss.el (nnrss-format-string): Use gnus-replace-in-string. + * nnwfm.el (nnwfm-create-mapping): Ditto. + 2001-12-06 01:00:00 ShengHuo ZHU * dgnushack.el (dgnushack-compile): nnrss.el and diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 6c58869..d930ba2 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -48,6 +48,22 @@ (autoload 'rmail-count-new-messages "rmail") (autoload 'rmail-show-message "rmail")) +(eval-and-compile + (cond + ((fboundp 'replace-in-string) + (defalias 'gnus-replace-in-string 'replace-in-string)) + ((fboundp 'replace-regexp-in-string) + (defun gnus-replace-in-string (string regexp newtext &optional literal) + (replace-regexp-in-string regexp newtext string nil literal))) + (t + (defun gnus-replace-in-string (string regexp newtext &optional literal) + (let ((start 0) tail) + (while (string-match regexp string start) + (setq tail (- (length string) (match-end 0))) + (setq string (replace-match newtext t t string)) + (setq start (- (length string) tail)))) + string)))) + (defun gnus-boundp (variable) "Return non-nil if VARIABLE is bound and non-nil." (and (boundp variable) @@ -421,13 +437,7 @@ Cache the result as a text property stored in DATE." (defun gnus-mode-string-quote (string) "Quote all \"%\"'s in STRING." - (save-excursion - (gnus-set-work-buffer) - (insert string) - (goto-char (point-min)) - (while (search-forward "%" nil t) - (insert "%")) - (buffer-string))) + (gnus-replace-in-string string "%" "%%")) ;; Make a hash table (default and minimum size is 256). ;; Optional argument HASHSIZE specifies the table size. diff --git a/lisp/nnrss.el b/lisp/nnrss.el index 204e31f..1b8ba8c 100644 --- a/lisp/nnrss.el +++ b/lisp/nnrss.el @@ -572,13 +572,8 @@ It is useful when `(setq nnrss-use-local t)'." (if changed (nnrss-save-server-data "")))) -(defun nnrss-replace-in-string (string match newtext) - (while (string-match match string) - (setq string (replace-match newtext t t string))) - string) - (defun nnrss-format-string (string) - (nnrss-replace-in-string (nnrss-string-as-multibyte string) " *\n *" " ")) + (gnus-replace-in-string (nnrss-string-as-multibyte string) " *\n *" " ")) (defun nnrss-node-text (node) (if (and node (listp node)) diff --git a/lisp/nnweb.el b/lisp/nnweb.el index 862d6f0..4cbcef2 100644 --- a/lisp/nnweb.el +++ b/lisp/nnweb.el @@ -989,11 +989,6 @@ If FOLLOW-REFRESH is non-nil, redirect refresh url in META." (listp (cdr element))) (nnweb-text-1 element))))) -(defun nnweb-replace-in-string (string match newtext) - (while (string-match match string) - (setq string (replace-match newtext t t string))) - string) - (provide 'nnweb) ;;; nnweb.el ends here diff --git a/lisp/nnwfm.el b/lisp/nnwfm.el index 2de45b7..eb29f0c 100644 --- a/lisp/nnwfm.el +++ b/lisp/nnwfm.el @@ -234,7 +234,7 @@ (setq description (car (last (nnweb-text (nth 1 row))))) (setq articles (string-to-number - (nnweb-replace-in-string + (gnus-replace-in-string (car (last (nnweb-text (nth 3 row)))) "," ""))) (when (and href (string-match "GroupId=\\([0-9]+\\)" href)) @@ -285,7 +285,7 @@ (while (re-search-forward " wr(" nil t) (forward-char -1) (setq elem (message-tokenize-header - (nnweb-replace-in-string + (gnus-replace-in-string (buffer-substring (1+ (point)) (progn @@ -294,7 +294,7 @@ "\\\\[\"\\\\]" ""))) (push (list (string-to-number (nth 1 elem)) - (nnweb-replace-in-string (nth 2 elem) "\"" "") + (gnus-replace-in-string (nth 2 elem) "\"" "") (string-to-number (nth 5 elem))) forum-contents)) (when (re-search-forward "href=\"\\(Thread.*DateLast=\\([^\"]+\\)\\)" -- 1.7.10.4