Created
June 1, 2010 08:37
-
-
Save hitode909/420718 to your computer and use it in GitHub Desktop.
Emacsがブロックしたらポップアップを出す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cl) | |
(require 'popup) | |
(lexical-let ((interval 0.1) | |
(last-called nil) | |
(timer nil) | |
(diff nil)) | |
(defun detect-block (flag) | |
"Start detecting block when flag is true." | |
(cond | |
((and flag timer) (detect-block nil)) | |
(flag (progn (setq timer | |
(run-with-timer interval interval | |
(lambda () | |
(unless last-called (setq last-called (float-time))) | |
(setq diff (- (float-time) last-called interval)) | |
(setq last-called (float-time)) | |
(when (>= diff interval) | |
(popup-tip (format "Blocked about %.3f secs." diff)) | |
;; (twittering-http-post twittering-api-host | |
;; "1/statuses/update" | |
;; `(("status" . ,(format "Emacs blocked about %.3f secs." diff)))) | |
)))) | |
(message "Start detecting block.") | |
)) | |
(timer (cancel-timer timer) | |
(setq timer nil) | |
(message "Cancel detecting block.") | |
) | |
))) | |
(provide 'detect-block) | |
; (detect-block t) | |
; (detect-block nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment