From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: [Patch] Allow a function as value of `appt-display-format' Date: Wed, 03 Dec 2008 20:27:40 +0100 Message-ID: <87r64pcb4j.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228332530 9917 80.91.229.12 (3 Dec 2008 19:28:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Dec 2008 19:28:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 03 20:29:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L7xPq-00005L-Da for ged-emacs-devel@m.gmane.org; Wed, 03 Dec 2008 20:29:42 +0100 Original-Received: from localhost ([127.0.0.1]:39947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7xOg-0004ki-8X for ged-emacs-devel@m.gmane.org; Wed, 03 Dec 2008 14:28:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L7xO1-0004Sp-Aw for emacs-devel@gnu.org; Wed, 03 Dec 2008 14:27:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L7xNz-0004S5-Oo for emacs-devel@gnu.org; Wed, 03 Dec 2008 14:27:48 -0500 Original-Received: from [199.232.76.173] (port=60309 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7xNz-0004Rz-GA for emacs-devel@gnu.org; Wed, 03 Dec 2008 14:27:47 -0500 Original-Received: from out1.smtp.messagingengine.com ([66.111.4.25]:43101) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L7xNy-000666-QO for emacs-devel@gnu.org; Wed, 03 Dec 2008 14:27:46 -0500 Original-Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 0A1D01CC27A for ; Wed, 3 Dec 2008 14:27:46 -0500 (EST) Original-Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 03 Dec 2008 14:27:46 -0500 X-Sasl-enc: w2SFMnVNjKngrUPVTR7n+gGF5t2P+bk7svoDcieW42/y 1228332465 Original-Received: from thinkpad.tsdh.de (p54AF2147.dip0.t-ipconnect.de [84.175.33.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 177B31CADD for ; Wed, 3 Dec 2008 14:27:44 -0500 (EST) Mail-Copies-To: never Mail-Followup-To: emacs-devel@gnu.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:106529 Archived-At: 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