unofficial mirror of emacs-devel@gnu.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

* Re: [Patch] Allow a function as value of `appt-display-format'
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2008-12-03 19:41 UTC (permalink / raw)
  To: emacs-devel

Tassilo Horn wrote:

> 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.

What does this do that setting appt-disp-window-function does not do
(apart from perhaps making the meaning clearer)?

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

Please wait. Thanks.




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

* Re: [Patch] Allow a function as value of `appt-display-format'
  2008-12-03 19:41 ` Glenn Morris
@ 2008-12-03 20:50   ` Tassilo Horn
  0 siblings, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2008-12-03 20:50 UTC (permalink / raw)
  To: emacs-devel

Glenn Morris <rgm@gnu.org> writes:

Hi Glenn,

>> 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.
>
> What does this do that setting appt-disp-window-function does not do

Nothing. ;-)

> (apart from perhaps making the meaning clearer)?

If you hadn't mentioned it I wouldn't have found out about
appt-disp-window-function, so at least the docs have to be improved.  Or
we use my version, drop `appt-disp-window-function' and call
`appt-disp-window directly' in the `window' case.  I'd vote for the
latter solution and volunteer to do it.

Bye,
Tassilo
-- 
When Chuck Norris makes a burrito, its main ingredient is real toes. 




^ 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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).