From 917921b92bd114a4cfbd9ab351e69586d64697c3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 25 Nov 2013 22:16:56 +0900 Subject: [PATCH] add my-idle-hook --- emacs.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/emacs.el b/emacs.el index f7a2a16..a7c6107 100644 --- a/emacs.el +++ b/emacs.el @@ -145,6 +145,22 @@ found, otherwise returns nil." (message "Tetris loaded!")) (message "Tetris found!")) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; my-idle-hook + +(defvar my-idle-hook nil + "Hook run when idle for several secs.") +(defvar my-idle-hook-sec 5 + "Second to run `my-idle-hook'.") +(run-with-idle-timer my-idle-hook-sec + t + (lambda () + (run-hooks 'my-idle-hook))) + +(add-hook 'my-idle-hook + (lambda () + (message "idle hook message"))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; start and quit