emacs-devel
[Top][All Lists]
Advanced

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

[Patch] Allow a function as value of `appt-display-format'


From: Tassilo Horn
Subject: [Patch] Allow a function as value of `appt-display-format'
Date: Wed, 03 Dec 2008 20:27:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi all,

I use appointments but I don't like the possible display styles.  So I
added a new choice to `appt-display-format' which allows adding a
function which does the job of displaying the message on its own.

For example I set `appt-display-format' to a function which calls the
external program notify-send to show the message.

Here's the diff:

--8<---------------cut here---------------start------------->8---
Index: lisp/calendar/appt.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/appt.el,v
retrieving revision 1.94
diff -u -r1.94 appt.el
--- lisp/calendar/appt.el       24 Nov 2008 19:53:00 -0000      1.94
+++ lisp/calendar/appt.el       3 Dec 2008 19:19:21 -0000
@@ -122,9 +122,11 @@
 (defcustom appt-display-format 'ignore
   "How appointment reminders should be displayed.
 The options are:
-   window - use a separate window
-   echo   - use the echo area
-   nil    - no visible reminder.
+   window   - use a separate window
+   echo     - use the echo area
+   FUNCTION - Invoke FUNCTION with the reminder message and
+              minutes to the appointment as argument
+   nil      - no visible reminder.
 See also `appt-audible' and `appt-display-mode-line'.
 
 The default value is 'ignore, which means to fall back on the value
@@ -132,6 +134,7 @@
   :type '(choice
           (const :tag "Separate window" window)
           (const :tag "Echo-area" echo)
+         (function :tag "Call function with reminder message and remaining 
minutes")
           (const :tag "No visible display" nil)
           (const :tag "Backwards compatibility setting - choose another value"
                  ignore))
@@ -243,7 +246,9 @@
                         nil
                         appt-delete-window-function))
           ((eq appt-display-format 'echo)
-           (message "%s" string)))))
+           (message "%s" string))
+         ((functionp appt-display-format)
+          (funcall appt-display-format (substring-no-properties string) 
mins)))))
 
 
 (defvar diary-selective-display)
--8<---------------cut here---------------end--------------->8---

Is it ok to commit, or should I wait until after the feature-freeze?

Bye,
Tassilo




reply via email to

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