emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [patch] Add faces for highlighting calendar events in the agenda
Date: Fri, 18 Nov 2011 13:47:22 +0100	[thread overview]
Message-ID: <80r515r411.fsf@somewhere.org> (raw)

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

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-faces-for-calendar-events-active-timestamps-or-S.patch --]
[-- Type: text/x-patch, Size: 3268 bytes --]

From 271dc5a7bb1c377cc38df63c50f2af41019abb34 Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <sva-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
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 "#FFFFFF" :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


             reply	other threads:[~2011-11-18 12:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 12:47 Sebastien Vauban [this message]
2011-12-11 17:49 ` [patch] Add faces for highlighting calendar events in the agenda Bastien

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.orgmode.org/

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

  git send-email \
    --in-reply-to=80r515r411.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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/org-mode.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).