From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Advising appt-mode Date: Sun, 15 Nov 2009 20:06:48 +0100 Organization: Friedrich Schiller University Jena, Germany Message-ID: References: <878wea5zpd.wl%richard.lewis@gold.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258324593 24150 80.91.229.12 (15 Nov 2009 22:36:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Nov 2009 22:36:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 15 23:36:26 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N9nhp-0004Kx-Sn for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Nov 2009 23:36:26 +0100 Original-Received: from localhost ([127.0.0.1]:48831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N9nhp-0003ki-GD for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Nov 2009 17:36:25 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!news.uni-jena.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-NNTP-Posting-Host: ppc201.mirz.uni-jena.de Original-X-Trace: lc03.rz.uni-jena.de 1258312008 32334 141.35.13.101 (15 Nov 2009 19:06:48 GMT) Original-X-Complaints-To: abuse@uni-jena.de Original-NNTP-Posting-Date: Sun, 15 Nov 2009 19:06:48 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:dsVUuMW21pIC+NCLQWD2HGyqna8= Original-Xref: news.stanford.edu gnu.emacs.help:174688 X-Mailman-Approved-At: Sun, 15 Nov 2009 17:34:25 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69766 Archived-At: 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 in %d minutes" (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.