Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
/u/joeheyming's Emacs break timer (modified)
;;; See:
(defvar breaktime-timer nil
"Holds the running break timer (if any).")
(defvar breaktime-interval (* 3 60 60)
"How often to take a break, in seconds.")
(defun breaktime--take-a-break ()
(switch-to-buffer (get-buffer-create "*breaktime*"))
(let ((inhibit-read-only t))
(animate-string "Time to take a break"
(/ (window-height) 2) (- (/ (window-width) 2) 12)))
(set-buffer-modified-p nil)
(defun breaktime-start ()
(when breaktime-timer
(cancel-timer breaktime-timer))
(setq breaktime-timer
(run-at-time t breaktime-interval 'breaktime--take-a-break)))
(defun breaktime-stop ()
(when breaktime-timer
(cancel-timer breaktime-timer)
(setq breaktime-timer nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment