Re: [O] [patch] Add faces for highlighting calendar events in the agenda

2011-12-11 Thread Bastien
Hi Sébastien,

Sebastien Vauban wxhgmqzgw...@spammotel.com writes:

 Find attached a patch to highlight 2 types of calendar events:

Applied, thanks a lot!

-- 
 Bastien



[O] [patch] Add faces for highlighting calendar events in the agenda

2011-11-18 Thread Sebastien Vauban
Hello,

Find attached a patch to highlight 2 types of calendar events:

- appointments (or whatever close to that), that is events based on an
  active timestamp;

- S-expressions to compute active timestamps for events.

The change is quite straightforward.

Best regards,
  Seb

-- 
Sebastien Vauban
From 271dc5a7bb1c377cc38df63c50f2af41019abb34 Mon Sep 17 00:00:00 2001
From: Sebastien Vauban s...@mygooglest.com
Date: Fri, 18 Nov 2011 13:41:47 +0100
Subject: [PATCH] Add faces for calendar events (active timestamps, or
 S-expressions).

	* org-agenda.el (org-agenda-get-timestamps)
	(org-agenda-get-sexps): Use face for highlighting calendar
	events.

	* org-faces.el: Add faces `org-agenda-calendar-event' and
	`org-agenda-calendar-sexp'.
---
 lisp/org-agenda.el |9 +
 lisp/org-faces.el  |   12 
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 0a98fbe..70c6c17 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3636,7 +3636,7 @@ given in `org-agenda-start-on-weekday'.
 	  (setq rtn (apply 'org-agenda-get-day-entries
 			   file date
 			   org-agenda-entry-types)
-	  (setq rtnall (append rtnall rtn
+	  (setq rtnall (append rtnall rtn ;; all entries
   (if org-agenda-include-diary
 	  (let ((org-agenda-search-headline-for-time t))
 	(require 'diary-lib)
@@ -3658,7 +3658,7 @@ given in `org-agenda-start-on-weekday'.
 	(put-text-property s (1- (point)) 'org-day-cnt day-cnt)
 	(when todayp
 	  (put-text-property s (1- (point)) 'org-today t))
-	(if rtnall (insert
+	(if rtnall (insert ;; all entries
 			(org-finalize-agenda-entries
 			 (org-agenda-add-time-grid-maybe
 			  rtnall ndays todayp))
@@ -4721,7 +4721,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 
 (defun org-agenda-get-timestamps ()
   Return the date stamp information for agenda display.
-  (let* ((props (list 'face nil
+  (let* ((props (list 'face 'org-agenda-calendar-event
 		  'org-not-done-regexp org-not-done-regexp
 		  'org-todo-regexp org-todo-regexp
 		  'org-complex-heading-regexp org-complex-heading-regexp
@@ -4822,7 +4822,8 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 (defun org-agenda-get-sexps ()
   Return the sexp information for agenda display.
   (require 'diary-lib)
-  (let* ((props (list 'mouse-face 'highlight
+  (let* ((props (list 'face 'org-agenda-calendar-sexp
+		  'mouse-face 'highlight
 		  'help-echo
 		  (format mouse-2 or RET jump to org file %s
 			  (abbreviate-file-name buffer-file-name
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 7b7dfa7..c15cb7d 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -695,6 +695,18 @@ month and 365.24 days for a year).
   Face used for agenda entries that come from the Emacs diary.
   :group 'org-faces)
 
+(defface org-agenda-calendar-event
+  'background light)) (:foreground #FF :background #1662AF))
+(((background dark)) (:foreground blue)))
+  Face used to show events and appointments in the agenda.
+  :group 'org-faces)
+
+(defface org-agenda-calendar-sexp
+  'background light)) (:background light blue))
+(((background dark)) (:foreground light blue)))
+  Face used to show events computed from a S-expression.
+  :group 'org-faces)
+
 (defconst org-level-faces
   '(org-level-1 org-level-2 org-level-3 org-level-4
 org-level-5 org-level-6 org-level-7 org-level-8
-- 
1.7.5.1