From 956fae5ca04ebf6edd34ef058a717d94f1fd4ecf Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 15 Jan 2018 20:56:24 -0800 Subject: [PATCH] define appt integration --- emacs_el/configuration/don-configuration.org | 47 +++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index 069e260..c75415c 100644 --- a/emacs_el/configuration/don-configuration.org +++ b/emacs_el/configuration/don-configuration.org @@ -1002,12 +1002,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (write-file "/tmp/timeline.org") (org-agenda arg "L"))) (define-key org-mode-map (kbd "C-c t") 'org-agenda-timeline-all) - ;; add automatic reminders for appointments - (defadvice org-agenda-redo (after org-agenda-redo-add-appts) - "Pressing `r' on the agenda will also add appointments." - (progn - (setq appt-time-msg-list nil) - (org-agenda-to-appt))) #+END_SRC ** General config @@ -1794,6 +1788,47 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori (load-file "~/.hide/org_gcal.el")) ) ) +#+END_SRC +** appt integration +#+BEGIN_SRC emacs-lisp + (use-package appt + :config + ;; Show notification 10 minutes before event + (setq appt-message-warning-time 10) + ;; Disable multiple reminders + (setq appt-display-interval appt-message-warning-time) + (setq appt-display-mode-line nil) + + ;; add automatic reminders for appointments + (defun my/org-agenda-to-appt () + (interactive) + (setq appt-time-msg-list nil) + (org-agenda-to-appt)) + ;; add reminders when starting emacs + (my/org-agenda-to-appt) + ;; when rebuilding the agenda + (defadvice org-agenda-redo (after org-agenda-redo-add-appts) + "Pressing `r' on the agenda will also add appointments." + (my/org-agenda-to-appt) + ) + ;; when saving all org buffers + (defadvice org-save-all-org-buffers (after org-save-all-org-buffers-add-appts) + "Re-add appts after saving all org buffers" + (my/org-agenda-to-appt)) + ; Display appointments as a window manager notification + (setq appt-disp-window-function 'my/appt-display) + (setq appt-delete-window-function (lambda () t)) + + (setq my/appt-notification-app (concat (getenv "HOME") "/bin/appt_notification")) + + (defun my/appt-display (min-to-app new-time msg) + (if (atom min-to-app) + (start-process "my/appt-notification-app" nil my/appt-notification-app min-to-app msg) + (dolist (i (number-sequence 0 (1- (length min-to-app)))) + (start-process "my/appt-notification-app" nil my/appt-notification-app + (nth i min-to-app) (nth i msg)))))) + + #+END_SRC ** End use-package #+BEGIN_SRC emacs-lisp -- 2.39.2