Skip to content

Instantly share code, notes, and snippets.

@peccu
Forked from hitode909/0.png
Created June 20, 2011 03:32
Show Gist options
  • Save peccu/1035077 to your computer and use it in GitHub Desktop.
Save peccu/1035077 to your computer and use it in GitHub Desktop.
Emacsがブロックしたらポップアップを出す
(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))
(todochiku-message "Blocked" (format "Blocked about %.3f secs." diff) (todochiku-icon 'irc))
;; (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)
@peccu
Copy link
Author

peccu commented Jun 20, 2011

todochikuでgrowlnotify使うようにした

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment