emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] tea-time?


From: Richard Riley
Subject: Re: [Orgmode] tea-time?
Date: Thu, 30 Jul 2009 14:34:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

Eric S Fraga <address@hidden> writes:

> At Wed, 29 Jul 2009 18:29:19 -0400,
> Nick Dokos wrote:
>> 
>> Samuel Wales <address@hidden> wrote:
>> 
>> > Hi Bastien,
>> > 
>> > I did not realize that appt could not be used.
>> > 
>> > On 2009-07-29, Bastien <address@hidden> wrote:
>> > > Please provide more information on how you tried it.
>> > 
>> > It works now.  I pulled in the interim, but I don't know if that's the
>> > reason.  I tried it twice, so I don't think I missed the notification.
>> > 
>> > However, the notification is in the minibuffer / echo area, and can
>> > easily be unnoticed if you are typing, as it goes away immediately.
>
> Samuel,
>
> you could investigate the linking of appt appointment notifications
> with external display tools, such as libnotify and osd methods.  An
> example is given by Richard Riley in this message in the mailing list
> archives:
>
> http://article.gmane.org/gmane.emacs.orgmode/8235
>
> I use something similar and following is a code extract from my .emacs
> based on some of Richard's and Nick's codes:
>
>
>
> ;; and from RichardRiley's entry: http://www.emacswiki.org/emacs/OrgMode-OSD
> ;; and from Nick Dokos: http://article.gmane.org/gmane.emacs.orgmode/5271
> (require 'appt)
> (defun rgr/xml-escape (s)
>   (setq s (replace-regexp-in-string "'" "&apos;" 
>   (replace-regexp-in-string "\"" "&quot;"
>   (replace-regexp-in-string "&" "&amp;" 
>   (replace-regexp-in-string "<" "&lt;"
>   (replace-regexp-in-string ">" "&gt;" s)))))))
>
> (when window-system
>   (defun rgr/osd-display (id msg &optional delay vattrib hattrib font) 
>     "Display a message msg using OSD. Currently requires gnome-osd-client"
>     (unless vattrib (setq vattrib "top"))
>     (unless hattrib (setq hattrib "right"))
>     (unless delay (setq delay 5000))
>     (unless font (setq font "Arial 12"))
>     (save-window-excursion
>       (shell-command
>        (format
>       "gnome-osd-client -f \"<message id='%s' osd_fake_translucent_bg='on' 
> osd_font='%s' animations='on' hide_timeout='%d' osd_vposition='%s' 
> osd_halignment='%s'>%s</message>\""    
>       id
>       font
>       delay
>       vattrib
>       hattrib
>       (rgr/xml-escape msg)
>       ))))
>   (defun esf/notification-display (msg min-to-app new-time)
>     (save-window-excursion
>       (shell-command
>        (format "notify-send -t 0 -i /home/ucecesf/s/share/emacs-icon.xpm 
> 'Agenda' \"In %s minutes:\n%s\"" min-to-app msg))))
> )
> (when window-system
>
>   (setq appt-display-format 'window)
>   
>   (defun org-osd-display (min-to-app new-time msg)
>     ; (rgr/osd-display msg msg -1 "center" "left" "Deja Vu Sans 20")
>     (esf/notification-display msg min-to-app new-time)
>     ; (message (format "executing notify-send %s minutes with message %s" 
> min-to-app msg))
>     )
>   
>   (setq appt-disp-window-function (function org-osd-display))
>   
>   ;; Run once, activate and schedule refresh
>   (run-at-time nil 3600 'org-agenda-to-appt)
>   (appt-activate t))
>
> (setq appt-time-msg-list nil)
> (org-agenda-to-appt)
>
> (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)))
>
> (ad-activate 'org-agenda-redo)


On that subject I dont use that stuff anymore, but use this on gnome for
erc notifications directed at me (so if erc buffers are hidden I get a
pop up when someone directs at msg directly at me). Its a lot nicer than
OSD imo and the code (primarily from Andy Stewart) could easily be adjusted
for your Org needs too:

,----
| (defvar erc-nick-notify-last '(0 0 0))
| (defvar erc-nick-notify-delay '(0 5 0))
| (defvar erc-nick-notify-cmd "notify-send")
| (defvar erc-nick-notify-icon "~/images/mail.png")
| (defvar erc-nick-notify-timeout 10000)
| (defvar erc-nick-notify-urgency "low")
| (defvar erc-nick-notify-category "im.received")
| 
| (add-hook 'erc-text-matched-hook
|               (lambda (match-type nickuserhost message)
|                 (cond
|                   ((eq match-type 'current-nick)
|                     (if (eq (string-match (concat (erc-current-nick) ":") 
message) 0) (shell-command (concat erc-nick-notify-cmd
|                                            " -i " erc-nick-notify-icon
|                                            " -t " (int-to-string
|                                                    erc-nick-notify-timeout)
|                                            " -c " erc-nick-notify-category
|                                            " '" message "'")))))))
`----

It might be of interest to someone.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]