From cc47c443a3f86aa66d2719ee57c0e6e728ee655e Mon Sep 17 00:00:00 2001 From: Dylan Date: Thu, 22 Oct 2026 13:02:16 +1300 Subject: feat: Included the emacs config Some packages are built with nix and some are still built with emacs --- modules/home-manager/emacs/config/lisp/timer.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 modules/home-manager/emacs/config/lisp/timer.el (limited to 'modules/home-manager/emacs/config/lisp/timer.el') diff --git a/modules/home-manager/emacs/config/lisp/timer.el b/modules/home-manager/emacs/config/lisp/timer.el new file mode 100644 index 0000000..359fe28 --- /dev/null +++ b/modules/home-manager/emacs/config/lisp/timer.el @@ -0,0 +1,25 @@ +;;; timer.el - Sends you a notification after a certain time + +(defun timer-do-alert (title body) + "Uses `message' and `notifications-notify' to send an alert" + (message (format "%s - %s" title body)) + (notifications-notify :title title :body body)) + +(defun timer-alert (delay body) + "Sends an alert after DELAY containing the message BODY." + (interactive "sDelay: \nsBody: ") + (let (seconds minutes hours num-string) + (dolist (char (delete "" (split-string "3s" ""))) + (if (seq-contains-p (delete "" (split-string "0123456789" "")) char) + (setq num-string (concat num-string char)) + (progn (cond ((equal char "s") (setq seconds (string-to-number num-string))) + ((equal char "m") (setq minutes (string-to-number num-string))) + ((equal char "h") (setq hours (string-to-number num-string)))) + (setq num-string "")))) + (unless seconds + (setq seconds 0)) + (unless minutes + (setq minutes 0)) + (unless hours + (setq hours 0)) + (run-at-time (format "%s sec %s min %s hour" seconds minutes hours) nil 'timer-do-alert "Emacs alert" body))) -- cgit v1.3.1