Skip to content

Instantly share code, notes, and snippets.

@sluchin
Created January 12, 2013 10:00
Show Gist options
  • Save sluchin/4517042 to your computer and use it in GitHub Desktop.
Save sluchin/4517042 to your computer and use it in GitHub Desktop.
(when (locate-library "tomatinho")
(autoload 'tomatinho "tomatinho" "Pomodoro Technique for emacs." t)
(eval-after-load "tomatinho"
'(progn
(when (boundp 'tomatinho-bar-length)
(setq tomatinho-bar-length 25))
(when (boundp 'tomatinho-pomodoro-length)
(setq tomatinho-pomodoro-length 25)) ; 25 分
(defvar tomatinho-pomodoro-pause-length 5) ; 5 分
(defvar tomatinho-pomodoro-long-pause-length 20) ; 20 分
(defadvice tomatinho-update (after tomatinho-pause-update activate)
(let ((type (car tomatinho-current)) (val (cdr tomatinho-current))
(length
(if (= 0 (% (+ 1 (length tomatinho-events)) 8))
tomatinho-pomodoro-long-pause-length
tomatinho-pomodoro-pause-length)))
(when (and (equal type 'pause) (>= (1+ val) length))
(setq tomatinho-events (append tomatinho-events `((pause . ,length))))
(setq tomatinho-current '(ok . 0)))))
(defun enable-tomatinho-pause ()
"Enable tomatinho pause control"
(interactive)
(ad-enable-advice 'tomatinho-update 'after 'tomatinho-pause-update)
(ad-activate 'tomatinho-update))
(defun disable-tomatinho-pause ()
"Disable tomatinho pause control"
(interactive)
(ad-disable-advice 'tomatinho-update 'after 'tomatinho-pause-update)
(ad-activate 'tomatinho-update)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment