all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Patch] Allow a function as value of `appt-display-format'
@ 2008-12-03 19:27 Tassilo Horn
  2008-12-03 19:41 ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Tassilo Horn @ 2008-12-03 19:27 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-03 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 19:27 [Patch] Allow a function as value of `appt-display-format' Tassilo Horn
2008-12-03 19:41 ` Glenn Morris
2008-12-03 20:50   ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.