* mixi.el: (mixi-get-matched-items): Add REVERSE argument.
authorbg66 <bg66>
Wed, 17 Jan 2007 11:02:29 +0000 (11:02 +0000)
committerbg66 <bg66>
Wed, 17 Jan 2007 11:02:29 +0000 (11:02 +0000)
(mixi-get-comments): Follow the change above.

ChangeLog
mixi.el

index ad7dea0..cde87ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-01-17  OHASHI Akira  <bg66@koka-in.org>
 
+       * mixi.el: (mixi-get-matched-items): Add REVERSE argument.
+       (mixi-get-comments): Follow the change above.
+
+2007-01-17  OHASHI Akira  <bg66@koka-in.org>
+
        * mixi.el: (mixi-realize-message): Follow the change of mixi.
 
 2007-01-17  OHASHI Akira  <bg66@koka-in.org>
diff --git a/mixi.el b/mixi.el
index ed00996..ff8a53a 100644 (file)
--- a/mixi.el
+++ b/mixi.el
@@ -440,15 +440,19 @@ Increase this value when unexpected error frequently occurs."
 (put 'with-mixi-post-form 'lisp-indent-function 'defun)
 (put 'with-mixi-post-form 'edebug-form-spec '(body))
 
-(defun mixi-get-matched-items (url regexp &optional range)
+(defun mixi-get-matched-items (url regexp &optional range reverse)
   "Get matched items to REGEXP in URL."
   (let ((page 1)
        ids)
     (catch 'end
       (while (or (null range) (< (length ids) range))
        (with-mixi-retrieve (format url page)
-         (let (found)
-           (while (and (re-search-forward regexp nil t)
+         (let ((func (if reverse (progn
+                                   (goto-char (point-max))
+                                   're-search-backward)
+                       're-search-forward))
+               found)
+           (while (and (funcall func regexp nil t)
                        (or (null range) (< (length ids) range)))
              (let ((num 1)
                    list)
@@ -2249,16 +2253,7 @@ Increase this value when unexpected error frequently occurs."
         (regexp (eval (intern (concat mixi-object-prefix name
                                       "-comment-list-regexp")))))
     (let ((items (mixi-get-matched-items
-                 (funcall list-page parent) regexp)))
-      (let (list)
-       (catch 'stop
-         (mapc (lambda (item)
-                 (when (and (numberp range)
-                            (>= (length list) range))
-                   (throw 'stop nil))
-                 (setq list (cons item list)))
-               (reverse items)))
-       (setq items (reverse list)))
+                 (funcall list-page parent) regexp range t)))
       (mapcar (lambda (item)
                (mixi-make-comment parent (mixi-make-friend
                                           (nth 7 item) (nth 8 item))