From: bg66 Date: Fri, 19 Jan 2007 00:37:09 +0000 (+0000) Subject: * mixi.el (mixi-realize-parent): Rename from `mixi-realize-object'. X-Git-Tag: mixi-el-1_0_0~90 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3f57e4b0b4b209d69b00576acfcb0918460875f1;p=elisp%2Fmixi.git * mixi.el (mixi-realize-parent): Rename from `mixi-realize-object'. (mixi-parent-p): New macro. (mixi-get-comments): Use them. * sb-mixi.el (shimbun-mixi-get-headers): Ditto. (shimbun-get-headers): Ditto. --- diff --git a/ChangeLog b/ChangeLog index ceac81c..76794cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-01-19 OHASHI Akira + + * mixi.el (mixi-realize-parent): Rename from `mixi-realize-object'. + (mixi-parent-p): New macro. + (mixi-get-comments): Use them. + + * sb-mixi.el (shimbun-mixi-get-headers): Ditto. + (shimbun-get-headers): Ditto. + 2007-01-18 OHASHI Akira * mixi.el (mixi-realize-object): New function. diff --git a/mixi.el b/mixi.el index 271ff27..b387e6b 100644 --- a/mixi.el +++ b/mixi.el @@ -546,16 +546,6 @@ Increase this value when unexpected error frequently occurs." object)) exp)) -(defun mixi-realize-object (object &optional page) - "Realize a OBJECT." - (unless (mixi-object-p object) - (signal 'wrong-type-argument (list 'mixi-object-p object))) - (let ((func (intern (concat mixi-object-prefix "realize-" - (mixi-object-name object))))) - (if page - (funcall func object page) - (funcall func object)))) - (defun mixi-object-timestamp (object) "Return the timestamp of OJBECT." (unless (mixi-object-p object) @@ -2113,6 +2103,19 @@ Increase this value when unexpected error frequently occurs." (nth 1 item))))) items))) +;; Parent object. +(defmacro mixi-parent-p (object) + `(or (eq (mixi-object-class ,object) 'mixi-diary) + (mixi-bbs-p object))) + +(defun mixi-realize-parent (parent &optional page) + "Realize a PARENT." + (unless (mixi-parent-p parent) + (signal 'wrong-type-argument (list 'mixi-parent-p parent))) + (let ((func (intern (concat mixi-object-prefix "realize-" + (mixi-object-name parent))))) + (funcall func parent page))) + ;; Comment object. (defun mixi-make-comment (parent owner time content) "Return a comment object." @@ -2246,8 +2249,8 @@ Increase this value when unexpected error frequently occurs." (defun mixi-get-comments (parent &optional range) "Get comments of PARENT." - (unless (mixi-object-p parent) - (signal 'wrong-type-argument (list 'mixi-object-p parent))) + (unless (mixi-parent-p parent) + (signal 'wrong-type-argument (list 'mixi-parent-p parent))) (let* ((name (mixi-object-name parent)) (list-page (intern (concat mixi-object-prefix name "-comment-list-page"))) @@ -2255,7 +2258,7 @@ Increase this value when unexpected error frequently occurs." "-comment-list-regexp")))) (page (funcall list-page parent))) (unless (mixi-object-realized-p parent) - (mixi-realize-object parent page) + (mixi-realize-parent parent page) (setq page nil)) (let ((items (mixi-get-matched-items page regexp range t))) (mapcar (lambda (item) diff --git a/sb-mixi.el b/sb-mixi.el index e14d07e..381c63a 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -256,8 +256,7 @@ of mixi object." (mapc (lambda (object) (when (mixi-object-p object) (let ((class (mixi-object-class object))) - (when (or (eq class 'mixi-diary) - (mixi-bbs-p object)) + (when (mixi-parent-p object) (let ((comments (mixi-get-comments object range))) (mapc (lambda (header) (push header headers)) @@ -301,8 +300,7 @@ of mixi object." (setq objects (mixi-get-diaries object range))) ((eq class 'mixi-community) (setq objects (mixi-get-bbses object range))) - ((or (eq class 'mixi-diary) - (mixi-bbs-p object)) + ((mixi-parent-p object) (setq objects (mixi-get-comments object range))) (t (error (concat (symbol-name class) " is not supported yet.")))))