summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-03-03 12:44:53 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-03-03 12:44:53 +0100
commitd3d2b3e8355b8bce98c4e72360dcd068b00cf81c (patch)
tree962a355fa47f09e2974fa056a05a0852085682e6
parent23d9c79654768f44c6c1383c0807c07ebb77c0eb (diff)
downloadorg-mode-d3d2b3e8355b8bce98c4e72360dcd068b00cf81c.tar.gz
Priorities: Allow specific faces for priority cookies
The variable org-priority-faces can now be used to set special faces for different priority cookies. Also, in the agenda, the default is now to fontify only the priority cookie, not the entire task. See the variable `org-agenda-fontify-priorities'.
-rw-r--r--ORGWEBPAGE/Changes.org13
-rwxr-xr-xlisp/ChangeLog12
-rw-r--r--lisp/org-agenda.el22
-rw-r--r--lisp/org-faces.el12
-rw-r--r--lisp/org.el12
5 files changed, 63 insertions, 8 deletions
diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org
index d4cd7d6..96bd566 100644
--- a/ORGWEBPAGE/Changes.org
+++ b/ORGWEBPAGE/Changes.org
@@ -193,6 +193,19 @@ of tag/property matches is described.
A new =<div id=content>= is wrapped around the entire page,
everything that is inside =<body>=.
+*** Faces for priority cookies can now be set freely
+
+The new variable =org-priority-faces= can be used to set faces
+for each priority.
+
+*** In agenda, only priority cookies get the special face
+
+So far, an entire task would get a special face when
+=org-agenda-fontify-priorities= was set. Now, the default value
+for this variable is the symbol =cookies=, which means that on
+the cookie is fontified. Set it to =t= if you want the entire
+task headline to be fontified.
+
* Version 6.23
** Overview
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8698b45..35e5d34 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,17 @@
2009-03-03 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-agenda.el (org-agenda-fontify-priorities): New default value
+ `cookies'.
+ (org-agenda-fontify-priorities): Renamed from
+ org-fontify-priorities.
+
+ * org.el (org-set-font-lock-defaults): Call
+ `org-font-lock-add-priority-faces'.
+ (org-font-lock-add-priority-faces): New function.
+
+ * org-faces.el: (org-set-tag-faces): New option.
+ (org-priority-faces): New variable.
+
* org-exp.el (org-export-as-html): Add a "content" div around the
entire content of the body tag.
(org-export-html-get-bibliography): New function.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8b07e04..bf7881b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1069,18 +1069,22 @@ it means that the tags should be flushright to that column. For example,
(if (fboundp 'defvaralias)
(defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
-(defcustom org-agenda-fontify-priorities t
+(defcustom org-agenda-fontify-priorities 'cookies
"Non-nil means, highlight low and high priorities in agenda.
When t, the highest priority entries are bold, lowest priority italic.
+However, settings in org-priority-faces will overrule these faces.
+When this variable is the symbol `cookies', only fontify the
+cookies, not the entire task.
This may also be an association list of priority faces, whose
keys are the character values of `org-highest-priority',
`org-default-priority', and `org-lowest-priority' (the default values
-are ?A, ?B, and ?C, respectively). The face may be a names face,
+are ?A, ?B, and ?C, respectively). The face may be a named face,
or a list like `(:background \"Red\")'."
:group 'org-agenda-line-format
:type '(choice
(const :tag "Never" nil)
(const :tag "Defaults" t)
+ (const :tag "Cookies only" cookies)
(repeat :tag "Specify"
(list (character :tag "Priority" :value ?A)
(sexp :tag "face")))))
@@ -2282,14 +2286,14 @@ Drawers will be excluded, also the line with scheduling/deadline info."
org-agenda-view-columns-initially)
(org-agenda-columns))
(when org-agenda-fontify-priorities
- (org-fontify-priorities))
+ (org-agenda-fontify-priorities))
(when (and org-agenda-dim-blocked-tasks org-blocker-hook)
(org-agenda-dim-blocked-tasks))
(run-hooks 'org-finalize-agenda-hook)
(setq org-agenda-type (get-text-property (point) 'org-agenda-type))
)))
-(defun org-fontify-priorities ()
+(defun org-agenda-fontify-priorities ()
"Make highest priority lines bold, and lowest italic."
(interactive)
(mapc (lambda (o) (if (eq (org-overlay-get o 'org-type) 'org-priority)
@@ -2305,12 +2309,16 @@ Drawers will be excluded, also the line with scheduling/deadline info."
l (or (get-char-property (point) 'org-lowest-priority)
org-lowest-priority)
p (string-to-char (match-string 1))
- b (match-beginning 0) e (point-at-eol)
+ b (match-beginning 0)
+ e (if (eq org-agenda-fontify-priorities 'cookies)
+ (match-end 0)
+ (point-at-eol))
ov (org-make-overlay b e))
(org-overlay-put
ov 'face
- (cond ((listp org-agenda-fontify-priorities)
- (cdr (assoc p org-agenda-fontify-priorities)))
+ (cond ((cdr (assoc p org-priority-faces)))
+ ((and (listp org-agenda-fontify-priorities)
+ (cdr (assoc p org-agenda-fontify-priorities)))
((equal p l) 'italic)
((equal p h) 'bold)))
(org-overlay-put ov 'org-type 'org-priority)))))
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 5924807..24f23a2 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -323,6 +323,18 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
(string :tag "keyword")
(sexp :tag "face"))))
+(defcustom org-priority-faces nil
+ "Faces for specific Priorities.
+This is a list of cons cells, with priority character in the car
+and faces in the cdr. The face can be a symbol, or a property
+list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
+ :group 'org-faces
+ :group 'org-todo
+ :type '(repeat
+ (cons
+ (character :tag "Priority")
+ (sexp :tag "face"))))
+
(defvar org-tags-special-faces-re nil)
(defun org-set-tag-faces (var value)
(set var value)
diff --git a/lisp/org.el b/lisp/org.el
index f1d3d98..47b9fd1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4333,7 +4333,7 @@ between words."
'(2 'org-headline-done t))
nil)
;; Priorities
- (list (concat "\\[#[A-Z0-9]\\]") '(0 'org-special-keyword t))
+ '(org-font-lock-add-priority-faces)
;; Tags
'(org-font-lock-add-tag-faces)
;; Special keywords
@@ -4404,6 +4404,16 @@ If KWD is a number, get the corresponding match group."
'font-lock-fontified t))
(backward-char 1))))
+(defun org-font-lock-add-priority-faces (limit)
+ "Add the special priority faces."
+ (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t)
+ (add-text-properties
+ (match-beginning 0) (match-end 0)
+ (list 'face (or (cdr (assoc (char-after (match-beginning 1))
+ org-priority-faces))
+ 'org-special-keyword)
+ 'font-lock-fontified t))))
+
(defun org-get-tag-face (kwd)
"Get the right face for a TODO keyword KWD.
If KWD is a number, get the corresponding match group."