松尾です。
自動取得 process 起動後に手動で別の timeline 取得要求を
出すと、複数のtimelineの内容が混ざって表示されるという
問題がありました。
これは取得完了時に実行される sentinel 自身が自分の取得
しようとしていた timeline を知らないために起こる問題です。
新たに変数 twittering-process-info-alist を導入して
各 process 毎に取得している timeline spec を記録するように
しました。
sentinel も最後に要求された timeline のみを採用するように
変更しましたので、 timeline の混在は起こりません。
今は最新の要求以外は捨てるようにしていますが、
twittering-timeline-data を
((spec1 . data1) (spec2 . data2) ...)
の形式に変更して全ての要求について保持しておけば表示側で
適当な spec の data を取り出すことで複数 buffer で別々の
timeline 表示も実現できると思います。
やたがわさんの search-mode branch では添付したパッチを当て
れば search-mode 専用の sentinel を使わなくても良くなり
そうです。
search-mode branch内のどの時点でのパッチにすれば良いか
分からなかったので、とりあえず hayamiz/master 先端の
ed67225499f77cadc419a4deffb13e3cace53b5c
に対するパッチにしてあります。
---
松尾 直志 <[email protected]>
>From ed50e272fde7b30d003acbdbad8eaa61bcd2ec56 Mon Sep 17 00:00:00 2001
From: Tadashi MATSUO <[email protected]>
Date: Mon, 1 Feb 2010 01:23:29 +0900
Subject: [PATCH] `twittering-http-get-default-sentinel' supports a response as
JSON.
* twittering-mode.el (twittering-http-get-default-sentinel):
support a response as JSON for "search" timeline spec.
(twittering-get-and-render-timeline): modified for "search"
timeline spec.
---
ChangeLog | 7 +++++++
twittering-mode.el | 26 ++++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2479518..738e16f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-02-01 Tadashi MATSUO <[email protected]>
+
+ * twittering-mode.el (twittering-http-get-default-sentinel):
+ support a response as JSON for "search" timeline spec.
+ (twittering-get-and-render-timeline): modified for "search"
+ timeline spec.
+
2010-01-31 Tadashi MATSUO <[email protected]>
* twittering-mode.el (twittering-http-get-default-sentinel):
diff --git a/twittering-mode.el b/twittering-mode.el
index 1628353..a41a951 100644
--- a/twittering-mode.el
+++ b/twittering-mode.el
@@ -1505,7 +1505,11 @@ Available keywords:
status
(("200")
(let* ((reversed-statuses
- (twittering-xmltree-to-status body))
+ (cond
+ ((eq 'search (car spec))
+ (twittering-json-to-status (json-read-from-string body)))
+ (t
+ (twittering-xmltree-to-status body))))
(statuses (reverse reversed-statuses)))
(setq twittering-new-tweets-count
(count t (mapcar
@@ -2378,13 +2382,19 @@ variable `twittering-status-format'"
(setq twittering-timeline-last-update nil
twittering-timeline-data nil))
(if (twittering-timeline-spec-primary-p spec)
- (let ((pair (twittering-timeline-spec-to-host-method spec)))
- (when pair
- (let* ((host (car pair))
- (method (cadr pair))
- (proc (twittering-get-tweets host method
- noninteractive id)))
- (twittering-register-process proc spec))))
+ (let ((info (twittering-timeline-spec-to-host-method spec))
+ (is-search-spec (eq 'search (car spec))))
+ (cond
+ ((null info) nil)
+ ((and is-search-spec (not (require 'json nil t)))
+ (message "search-mode is currently disabled; need json.el."))
+ (t
+ (let* ((host (elt info 0))
+ (method (elt info 1))
+ (word (and is-search-spec (cadr spec)))
+ (proc (twittering-get-tweets host method noninteractive
+ id word)))
+ (twittering-register-process proc spec)))))
(let ((type (car spec)))
(error "%s has not been supported yet" type)))))
--
1.5.6.5
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
twmode-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/twmode-users