[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advising appt-mode
From: |
Michael Heerdegen |
Subject: |
Re: Advising appt-mode |
Date: |
Sun, 15 Nov 2009 20:06:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Your defadvice is syntactically correct (and will be used if you didn't
forget to activate it.) But it won't work. Let's have a look at the
altered symbol-function of appt-check:
(lambda
(&optional force)
#("Advice doc string" 0 17
(ad-advice-info appt-check))
(interactive "P")
(let
(ad-return-value)
(setq ad-return-value
(ad-Orig-appt-check force))
(when
(and appt-issue-message appt-time-msg-list)
(when
(and
(<= min-to-app appt-message-warning-time)
(>= min-to-app 0))
(rjl/notify
(format "%s <b>in %d minutes</b>"
(cadr
(car appt-time-msg-list))
min-to-app)
"Appointment")))
ad-return-value))
You see that there is a reference to `min-to-app' in your code, a
variable which is only visible _inside_ `ad-Orig-appt-check'
(`ad-Orig-appt-check' holds the original symbol-function of
`appt-check'). Note that `appt-check' checks for all appointments at
once in a while loop, so `min-to-app' may change its value several times
each call.
I think you can do what you want with an advice of
`appt-display-message'. If you really want to change `appt-check' in
such a way, you will will have to redefine it with `defun'.
Michael.