From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sarah Bagby Subject: org-mode and appointment notifications on Mac OS 10.8 Date: Tue, 12 Feb 2013 23:16:54 -0800 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_79149175-AA98-43AB-9D11-CC84DAA5736C" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5WaS-0001Kj-PV for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 02:17:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5WaP-0005yt-9A for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 02:17:00 -0500 Received: from mail.lsit.ucsb.edu ([128.111.90.138]:36336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5WaO-0005ya-SZ for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 02:16:57 -0500 Received: from filter-priv.lsit.ucsb.edu (filter-priv.lsit.ucsb.edu [10.0.169.14]) by mail-priv.lsit.ucsb.edu (Postfix) with ESMTP id 3C6788000E for ; Tue, 12 Feb 2013 23:16:55 -0800 (PST) Received: from [10.0.1.198] (ip72-194-223-162.sb.sd.cox.net [72.194.223.162]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: bagby@mail) by mail.lsit.ucsb.edu (Postfix) with ESMTPSA id EA5618000B for ; Tue, 12 Feb 2013 23:16:54 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --Apple-Mail=_79149175-AA98-43AB-9D11-CC84DAA5736C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 I've been looking for a way to get org-mode to push appointment = notifications from my org-agenda to the Notification Center on Mac OS = 10.8 (Mountain Lion). Thanks to Eloy Dur=E1n's terminal-notifier = project (https://github.com/alloy/terminal-notifier), the code below = seems to do the trick. This is mostly hacked together from other = people's approaches using different window functions: http://emacs-fu.blogspot.com/2009/11/showing-pop-ups.html http://article.gmane.org/gmane.emacs.orgmode/5271 http://article.gmane.org/gmane.emacs.orgmode/5806 I'm posting in the hopes that this will be useful to others, and would = welcome any feedback. Sarah Bagby = ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'appt) (setq appt-time-msg-list nil) ;; clear existing appt list (setq appt-display-interval '10) ;; warn every 10 minutes from t - = appt-message-warning-time (setq appt-message-warning-time '10 ;; send first warning 10 minutes before = appointment appt-display-mode-line nil ;; don't show in the modeline appt-display-format 'window) ;; pass warnings to the designated = window function (appt-activate 1) ;; activate appointment notification (display-time) ;; activate time display (org-agenda-to-appt) ;; generate the appt list from org = agenda files on emacs launch (run-at-time "24:01" 3600 'org-agenda-to-appt) ;; update appt = list hourly (add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt) ;; update appt = list on agenda view ;; set up the call to terminal-notifier (defvar my-notifier-path=20 = "~/terminal-notifier_1.4.2/terminal-notifier.app/Contents/MacOS/terminal-n= otifier") =20 (defun my-appt-send-notification (title msg) (shell-command (concat my-notifier-path " -message " msg " -title " = title))) ;; designate the window function for my-appt-send-notification (defun my-appt-display (min-to-app new-time msg) (my-appt-send-notification=20 (format "'Appointment in %s minutes'" min-to-app) ;; passed to = -title in terminal-notifier call (format "'%s'" msg))) ;; passed to = -message in terminal-notifier call (setq appt-disp-window-function (function my-appt-display)) = ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ----- Sarah Bagby Postdoctoral scientist, Valentine lab Department of Earth Science / Marine Science Institute Webb Hall UC Santa Barbara Santa Barbara, CA 93106 bagby@geol.ucsb.edu ----- --Apple-Mail=_79149175-AA98-43AB-9D11-CC84DAA5736C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 https://github.com/all= oy/terminal-notifier), the code below seems to do the trick. =  This is mostly hacked together from other people's approaches = using different window functions:


I'm = posting in the hopes that this will be useful to others, and would = welcome any feedback.

Sarah = Bagby

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'appt)
(setq = appt-time-msg-list nil)    ;; clear existing appt = list
(setq appt-display-interval '10) ;; warn = every 10 minutes from t - = appt-message-warning-time
(setq
  appt-message-warning-time '10  ;; = send first warning 10 minutes before = appointment
  appt-display-mode-line nil   =   ;; don't show in the modeline
  = appt-display-format 'window)   ;; pass warnings to the designated = window function
(appt-activate 1)         =        ;; activate appointment = notification
(display-time)         =           ;; activate time = display

(org-agenda-to-appt) =             ;; generate the appt list from = org agenda files on emacs launch
(run-at-time "24:01" = 3600 'org-agenda-to-appt)           ;; update = appt list hourly
(add-hook 'org-finalize-agenda-hook = 'org-agenda-to-appt) ;; update appt list on agenda = view

;; set up the call to = terminal-notifier
(defvar = my-notifier-path 
  = "~/terminal-notifier_1.4.2/terminal-notifier.app/Contents/MacOS/terminal-n= otifier")  
(defun = my-appt-send-notification (title msg)
  (shell-command = (concat my-notifier-path " -message " msg " -title " = title)))

;; designate the window function for = my-appt-send-notification
(defun my-appt-display = (min-to-app new-time msg)
  = (my-appt-send-notification 
    (format = "'Appointment in %s minutes'" min-to-app)    ;; passed to = -title in terminal-notifier call
    (format = "'%s'" msg)))                 =                ;; passed to = -message in terminal-notifier call
(setq = appt-disp-window-function (function = my-appt-display))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


-----
Department of Earth Science / Marine = Science Institute
Webb = Hall
UC = Santa Barbara
Santa = Barbara, CA 93106
----= -

= --Apple-Mail=_79149175-AA98-43AB-9D11-CC84DAA5736C--