From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-devel@gnu.org
Subject: [Patch] Allow a function as value of `appt-display-format'
Date: Wed, 03 Dec 2008 20:27:40 +0100 [thread overview]
Message-ID: <87r64pcb4j.fsf@thinkpad.tsdh.de> (raw)
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
next reply other threads:[~2008-12-03 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-03 19:27 Tassilo Horn [this message]
2008-12-03 19:41 ` [Patch] Allow a function as value of `appt-display-format' Glenn Morris
2008-12-03 20:50 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r64pcb4j.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).