Synch with Gnus.
[elisp/gnus.git-] / lisp / nnweb.el
index de3bb7f..ded79d9 100644 (file)
@@ -350,9 +350,13 @@ and `altavista'.")
       (setq url-current-callback-data data
            url-be-asynchronous t
            url-current-callback-func callback)
-      (url-retrieve url))
+      (url-retrieve url nil))
     (setq-default url-be-asynchronous old-asynch)))
 
+(if (fboundp 'url-retrieve-synchronously)
+    (defun nnweb-url-retrieve-asynch (url callback &rest data)
+      (url-retrieve url callback data)))
+
 ;;;
 ;;; DejaNews functions.
 ;;;
@@ -723,20 +727,21 @@ and `altavista'.")
   "Decode all HTML entities."
   (goto-char (point-min))
   (while (re-search-forward "&\\(#[0-9]+\\|[a-z]+\\);" nil t)
-    (replace-match (char-to-string 
-                   (if (eq (aref (match-string 1) 0) ?\#)
+    (let ((elem (if (eq (aref (match-string 1) 0) ?\#)
                        (let ((c
                               (string-to-number (substring 
                                                  (match-string 1) 1))))
                          (if (mm-char-or-char-int-p c) c 32))
                      (or (cdr (assq (intern (match-string 1))
                                     w3-html-entities))
-                         ?#)))
-                  t t)))
+                         ?#))))
+      (unless (stringp elem)
+       (setq elem (char-to-string elem)))
+      (replace-match elem t t))))
 
-(defun nnweb-decode-entities-string (str)
+(defun nnweb-decode-entities-string (string)
   (with-temp-buffer
-    (insert str)
+    (insert string)
     (nnweb-decode-entities)
     (buffer-substring (point-min) (point-max))))
 
@@ -817,6 +822,11 @@ 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