Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sentinels for asynchronous retrieval are invoked with a delay.

* twittering-mode.el: Sentinels for asynchronous retrieval are
invoked with `run-with-idle-timer'. The delay will prevent Emacs
from stucking on inputting characters on other buffer.
(twittering-url-request-sentinel-delay): new variable.
(twittering-url-retrieve-async-sentinel): invoke sentinels with
`run-with-idle-timer'.
  • Loading branch information...
commit e96ac828b9f34288e8e28105922d1a9d7caf6256 1 parent bb7026f
@cvmat cvmat authored
Showing with 34 additions and 5 deletions.
  1. +7 −0 ChangeLog
  2. +6 −0 NEWS
  3. +6 −0 NEWS.ja
  4. +15 −5 twittering-mode.el
View
7 ChangeLog
@@ -41,6 +41,13 @@
(twittering-url-retrieve-async-sentinel): new function.
(twittering-url-retrieve-async-clean-up-sentinel): new function.
+ * twittering-mode.el: Sentinels for asynchronous retrieval are
+ invoked with `run-with-idle-timer'. The delay will prevent Emacs
+ from stucking on inputting characters on other buffer.
+ (twittering-url-request-sentinel-delay): new variable.
+ (twittering-url-retrieve-async-sentinel): invoke sentinels with
+ `run-with-idle-timer'.
+
2010-11-13 Tadashi MATSUO <tad@mymail.twin.jp>
* twittering-mode.el: `twittering-send-http-request' correctly
View
6 NEWS
@@ -96,6 +96,12 @@
Icon images can be retrieved by the same connection method as that used
for retrieving tweets. The priority of methods is similarly determined
by `twittering-connection-type-order'.
+* Lazy invocation of `convert'.
+ The program `convert' for converting the size of icon images is invoked
+ after Emacs remains idle a certain time. The delay will prevent Emacs
+ from stucking on inputting characters on other buffer. The delay time is
+ specified by the new variable `twittering-url-request-sentinel-delay',
+ which is 1 second by default.
* ...
### Bug fixes
View
6 NEWS.ja
@@ -98,6 +98,12 @@
アイコン画像の取得にtweet取得と同じ通信方法(connection method)が使える
ようになりました。各methodの優先順位はtweet取得と同じく変数
`twittering-connection-type-order'で決定されます。
+* アイコン画像変更プログラムの遅延呼び出し
+ アイコン画像を指定されたサイズに変更するためのプログラム(convert)実行
+ をEmacsがユーザからの入力待ち状態(idle状態)になって一定時間が経過して
+ から行うようにしました。待ち時間は変数
+ `twittering-url-request-sentinel-delay'で指定できます。デフォルトの
+ 待ち時間は1秒です。
* ...
### バグ修正
View
20 twittering-mode.el
@@ -2685,6 +2685,11 @@ like following:
(defvar twittering-internal-url-queue nil)
(defvar twittering-url-request-resolving-p nil)
(defvar twittering-url-request-retry-limit 3)
+(defvar twittering-url-request-sentinel-delay 1.0
+ "*Delay from completing retrieval to invoking associated sentinels.
+Sentinels registered by `twittering-url-retrieve-async' will be invoked
+after retrieval is completed and Emacs remains idle a certain time, which
+this variable specifies. The unit is second.")
(defun twittering-remove-redundant-queries (queue)
(remove nil
@@ -2730,9 +2735,12 @@ like following:
(let ((sentinels (gethash uri twittering-url-request-sentinel-hash)))
(when sentinels
(remhash uri twittering-url-request-sentinel-hash)
- (mapc (lambda (func)
- (funcall func uri body))
- sentinels)
+ (run-with-idle-timer twittering-url-request-sentinel-delay nil
+ (lambda (sentinels uri body)
+ (mapc (lambda (func)
+ (funcall func uri body))
+ sentinels))
+ sentinels uri body)
;; Without the following nil, it seems that the value of
;; `sentinels' is displayed.
nil))))))
@@ -2750,8 +2758,10 @@ like following:
(defun twittering-url-retrieve-async (url &optional sentinel)
"Retrieve URL asynchronously and call SENTINEL with the retrieved data.
The request is placed at the last of queries queue. When the data has been
-retrieved, SENTINEL will be called as (funcall SENTINEL URL url-data).
-The retrieved data can be referred as (gethash url twittering-url-data-hash)."
+retrieved and Emacs remains idle a certain time specified by
+`twittering-url-request-sentinel-delay', SENTINEL will be called as
+ (funcall SENTINEL URL url-data).
+The retrieved data can be referred as (gethash URL twittering-url-data-hash)."
(add-to-list 'twittering-url-request-list url t)
(when sentinel
(let ((current (gethash url twittering-url-request-sentinel-hash)))
Please sign in to comment.
Something went wrong with that request. Please try again.