emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH 1/2] org-agenda: introduce org-agenda-today and org-agenda-get-day-face
Date: Mon, 08 Nov 2010 20:28:23 +0100	[thread overview]
Message-ID: <87vd47fwdk.fsf@keller.adm.naquadah.org> (raw)
In-Reply-To: <629899F4-DD71-4710-8492-367FB443A0DB@gmail.com> (Carsten Dominik's message of "Mon, 8 Nov 2010 12:34:09 -0600")

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On Mon, Nov 08 2010, Carsten Dominik wrote:

> can you please rename org-agenda-today to org-agenda-today-p?
> I think it would make its use clearer.

I think you misread the function. I've added org-agenda-today which
returns today, and just rewrite org-agenda-todayp to use that one.

> Also, couly you please specify in the docstring of org-agenda-day-face-
> function how the day is coming in into the user-defined function?  As a day
> number or a calendar date list?

It's a calendar date list.

Updated patch attached.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-agenda-add-org-agenda-day-face-function.patch --]
[-- Type: text/x-diff, Size: 1911 bytes --]

From e59409e447f18d92eca9c8faf271901c437746ff Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Mon, 8 Nov 2010 18:23:07 +0100
Subject: [PATCH] org-agenda: add org-agenda-day-face-function

* lisp/org-agenda.el (org-agenda-day-face-function): New variable.
(org-agenda-get-day-face): Use org-agenda-day-face-function.

Signed-off-by: Julien Danjou <julien@danjou.info>
 lisp/org-agenda.el |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 98371e6..aba85eb 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1433,6 +1433,14 @@ determines if it is a foreground or a background color."
 				   (string :tag "Color")
 				   (sexp :tag "Face"))))))
+(defcustom org-agenda-day-face-function nil
+  "Function called to determine what face should be used to display a day.
+The only argument passed to that function is the day in the
+calendar date list format.  It should returns a face, or nil if it
+does not want to specify a face and let the normal rules apply."
+  :group 'org-agenda-line-format
+  :type 'function)
 (defcustom org-agenda-category-icon-alist nil
   "Alist of category icon to be displayed in agenda views.
@@ -3108,11 +3116,13 @@ no longer in use."
 (defun org-agenda-get-day-face (date)
   "Return the face DATE should be displayed with."
-  (cond ((org-agenda-todayp date)
-	 'org-agenda-date-today)
-	((member (calendar-day-of-week date) org-agenda-weekend-days)
-	 'org-agenda-date-weekend)
-	(t 'org-agenda-date)))
+  (or (and (functionp org-agenda-day-face-function)
+	   (funcall org-agenda-day-face-function date))
+      (cond ((org-agenda-todayp date)
+	     'org-agenda-date-today)
+	    ((member (calendar-day-of-week date) org-agenda-weekend-days)
+	     'org-agenda-date-weekend)
+	    (t 'org-agenda-date))))
 ;;; Agenda timeline

[-- Attachment #3: Type: text/plain, Size: 79 bytes --]

Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.

  reply	other threads:[~2010-11-08 19:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08 17:23 [PATCH 1/2] org-agenda: introduce org-agenda-today and org-agenda-get-day-face Julien Danjou
2010-11-08 17:23 ` [PATCH 2/2] org-agenda: add org-agenda-day-face-function Julien Danjou
2010-11-12 15:30   ` Carsten Dominik
2010-11-12 15:34     ` Julien Danjou
2010-11-12 15:43       ` Carsten Dominik
2010-11-12 15:50         ` Julien Danjou
2010-11-08 18:34 ` [PATCH 1/2] org-agenda: introduce org-agenda-today and org-agenda-get-day-face Carsten Dominik
2010-11-08 19:28   ` Julien Danjou [this message]
2010-11-08 19:59     ` Carsten Dominik
2010-11-09 10:59 ` Julien Danjou

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:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vd47fwdk.fsf@keller.adm.naquadah.org \
    --to=julien@danjou.info \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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