Last active
June 13, 2016 16:31
-
-
Save humitos/6939f46c7377007b648b93a771cf1cf3 to your computer and use it in GitHub Desktop.
This file contains 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
;; Solución ELISP a http://elblogdehumitos.com.ar/posts/wordpress/no-mas-mate-frio/ | |
(global-set-key (kbd "C-c m") 'mate-start-stop) | |
(defun mate-start-stop () | |
"Start or stop the current timer" | |
(interactive) | |
(if (eq mate-say-cancel-id nil) | |
(progn | |
(mate-say-start) | |
(message "Mate: Timer started.")) | |
(progn | |
(mate-say-stop) | |
(setq mate-say-cancel-id nil) | |
(message "Mate: Timer stopped.")))) | |
(defun mate-say (notify) | |
"Use espeak to say 'mate' and show a notification using 'notify' if NOTIFY" | |
(shell-command "espeak -v es Mate") | |
(if (eq notify t) | |
(shell-command "notify-send -i terminal -t 3000 Mate \"Cebar un mate\""))) | |
(defvar mate-say-cancel-id nil | |
"ID of the timer to be cancelled") | |
(defun mate-say-start () | |
"Start the timer to call `mate-say` function" | |
(setq mate-say-cancel-id (run-with-timer nil 180 'mate-say t))) | |
(defun mate-say-stop () | |
"Cancel the timer to stop calling `mate-say` function" | |
(cancel-timer mate-say-cancel-id)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment