]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-faces.el
Close bug#3992.
[gnu-emacs] / lisp / org / org-faces.el
index c3e4ac60950a80f0d2ffb8c85a7e8b617b9530aa..2e5e63199a05a86ad9d68daa0c6eb37b9ab8bb55 100644 (file)
@@ -1,11 +1,12 @@
 ;;; org-faces.el --- Face definitions for Org-mode.
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.33x
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;
 ;;; Commentary:
 
-;; This file contains the face definitons for Org.
+;; This file contains the face definitions for Org.
 
 ;;; Code:
 
 (require 'org-macs)
 (require 'org-compat)
 
+(defun org-copy-face (old-face new-face docstring &rest attributes)
+  (unless (facep new-face)
+    (if (fboundp 'set-face-attribute)
+       (progn
+         (make-face new-face)
+         (set-face-attribute new-face nil :inherit old-face)
+         (apply 'set-face-attribute new-face nil attributes)
+         (set-face-doc-string new-face docstring))
+      (copy-face old-face new-face)
+      (if (fboundp 'set-face-doc-string)
+         (set-face-doc-string new-face docstring)))))
+(put 'org-copy-face 'lisp-indent-function 2)
+
 (defgroup org-faces nil
   "Faces in Org-mode."
   :tag "Org Faces"
@@ -163,7 +177,7 @@ This is actually only part of the face definition for the text in column view.
 The following faces apply, with this priority.
 
 1. The color of the reference face.  This is normally the level fact that
-   is used in the outline.  In agenda-mode, it will be the face of the 
+   is used in the outline.  In agenda-mode, it will be the face of the
    first character in the line.  The color is explicitly retained to
    make sure that the column line still looks a bit like the structure
    line it is masking.
@@ -203,6 +217,12 @@ column view defines special faces for each outline level.  See the file
                      :height (face-attribute 'default :height)
                      :family (face-attribute 'default :family)))
 
+(defface org-agenda-column-dateline
+  (org-compatible-face 'org-column
+    '((t nil)))
+  "Face used in agenda column view for datelines with summaries."
+  :group 'org-faces)
+
 (defface org-warning
   (org-compatible-face 'font-lock-warning-face
     '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
@@ -233,6 +253,13 @@ column view defines special faces for each outline level.  See the file
   "Face for links."
   :group 'org-faces)
 
+(defface org-footnote
+  '((((class color) (background light)) (:foreground "Purple" :underline t))
+    (((class color) (background dark)) (:foreground "Cyan" :underline t))
+    (t (:underline t)))
+  "Face for links."
+  :group 'org-faces)
+
 (defface org-ellipsis
   '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
     (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
@@ -244,26 +271,28 @@ column view defines special faces for each outline level.  See the file
   '((((class color) (background light)) (:underline t))
     (((class color) (background dark)) (:underline t))
     (t (:underline t)))
-  "Face for links."
+  "Face for link targets."
   :group 'org-faces)
 
 (defface org-date
   '((((class color) (background light)) (:foreground "Purple" :underline t))
     (((class color) (background dark)) (:foreground "Cyan" :underline t))
     (t (:underline t)))
-  "Face for links."
+  "Face for date/time stamps."
   :group 'org-faces)
 
 (defface org-sexp-date
   '((((class color) (background light)) (:foreground "Purple"))
     (((class color) (background dark)) (:foreground "Cyan"))
     (t (:underline t)))
-  "Face for links."
+  "Face for diary-like sexp date specifications."
   :group 'org-faces)
 
 (defface org-tag
   '((t (:bold t)))
-  "Face for tags."
+  "Default face for tags.
+Note that the variable `org-tag-faces' can be used to overrule this face for
+specific tags."
   :group 'org-faces)
 
 (defface org-todo ; font-lock-warning-face
@@ -285,6 +314,20 @@ column view defines special faces for each outline level.  See the file
   "Face used for todo keywords that indicate DONE items."
   :group 'org-faces)
 
+(defface org-agenda-done ;; originally copied from font-lock-type-face
+  (org-compatible-face nil
+    '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
+      (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
+      (((class color) (min-colors 8)) (:foreground "green"))
+      (t (:bold nil))))
+  "Face used in agenda, to indicate lines switched to DONE.
+This face is used to de-emphasize items that where brightly colord in the
+agenda because they were things to do, or overdue.  The DONE state itself
+is of course immediately visible, but for example a passed deadline is
+\(by default) very bright read.  This face could be simply the default face
+of the frame, for example."
+  :group 'org-faces)
+
 (defface org-headline-done ;; originally copied from font-lock-string-face
   (org-compatible-face nil
     '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
@@ -307,6 +350,56 @@ 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)
+  (if (not value)
+      (setq org-tags-special-faces-re nil)
+    (setq org-tags-special-faces-re
+         (concat ":\\(" (mapconcat 'car value "\\|") "\\):"))))
+
+(defface org-checkbox
+  (org-compatible-face 'bold
+    '((t (:bold t))))
+  "Face for checkboxes"
+  :group 'org-faces)
+
+
+(org-copy-face 'org-todo 'org-checkbox-statistics-todo
+              "Face used for unfinished checkbox statistics.")
+
+(org-copy-face 'org-done 'org-checkbox-statistics-done
+              "Face used for finished checkbox statistics.")
+
+(defcustom org-tag-faces nil
+  "Faces for specific tags.
+This is a list of cons cells, with tags 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).
+If you set this variable through customize, it will immediately be effective
+in new buffers and in modified lines.
+If you set it with Lisp, a restart of Emacs is required to activate the
+changes."
+  :group 'org-faces
+  :group 'org-tags
+  :set 'org-set-tag-faces
+  :type '(repeat
+         (cons
+          (string :tag "Tag")
+          (sexp :tag "Face"))))
+
 (defface org-table ;; originally copied from font-lock-function-name-face
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
@@ -329,7 +422,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
   :group 'org-faces)
 
 (defface org-code
-  (org-compatible-face nil
+  (org-compatible-face 'shadow
     '((((class color grayscale) (min-colors 88) (background light))
        (:foreground "grey50"))
       (((class color grayscale) (min-colors 88) (background dark))
@@ -342,8 +435,28 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
   :group 'org-faces
   :version "22.1")
 
+(defface org-meta-line
+  (org-compatible-face 'font-lock-comment-face nil)
+  "Face for meta lines startin with \"#+\"."
+  :group 'org-faces
+  :version "22.1")
+
+(defface org-block
+  (org-compatible-face 'shadow
+    '((((class color grayscale) (min-colors 88) (background light))
+       (:foreground "grey50"))
+      (((class color grayscale) (min-colors 88) (background dark))
+       (:foreground "grey70"))
+      (((class color) (min-colors 8) (background light))
+       (:foreground "green"))
+      (((class color) (min-colors 8) (background dark))
+       (:foreground "yellow"))))
+  "Face text in #+begin ... #+end blocks."
+  :group 'org-faces
+  :version "22.1")
+
 (defface org-verbatim
-  (org-compatible-face nil
+  (org-compatible-face 'shadow
     '((((class color grayscale) (min-colors 88) (background light))
        (:foreground "grey50" :underline t))
       (((class color grayscale) (min-colors 88) (background dark))
@@ -356,6 +469,27 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
   :group 'org-faces
   :version "22.1")
 
+(org-copy-face 'org-block 'org-quote
+   "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks.")
+(org-copy-face 'org-block 'org-verse
+   "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.")
+
+(defface org-clock-overlay ;; copied from secondary-selection
+  (org-compatible-face nil
+    '((((class color) (min-colors 88) (background light))
+       (:background "yellow1"))
+      (((class color) (min-colors 88) (background dark))
+       (:background "SkyBlue4"))
+      (((class color) (min-colors 16) (background light))
+       (:background "yellow"))
+      (((class color) (min-colors 16) (background dark))
+       (:background "SkyBlue4"))
+      (((class color) (min-colors 8))
+       (:background "cyan" :foreground "black"))
+      (t (:inverse-video t))))
+    "Basic face for displaying the secondary selection."
+    :group 'org-faces)
+
 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
@@ -367,19 +501,30 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
   "Face used in agenda for captions and dates."
   :group 'org-faces)
 
-(unless (facep 'org-agenda-date)
-  (copy-face 'org-agenda-structure 'org-agenda-date)
-  (set-face-doc-string 'org-agenda-date
-                      "Face used in agenda for normal days."))
+(org-copy-face 'org-agenda-structure 'org-agenda-date
+              "Face used in agenda for normal days.")
 
-(unless (facep 'org-agenda-date-weekend)
-  (copy-face 'org-agenda-date 'org-agenda-date-weekend)
-  (set-face-doc-string 'org-agenda-date-weekend
-                      "Face used in agenda for weekend days.
+(org-copy-face 'org-agenda-date 'org-agenda-date-today
+              "Face used in agenda for today."
+              :weight 'bold :italic 't)
+
+(org-copy-face 'secondary-selection 'org-agenda-clocking
+              "Face marking the current clock item in the agenda.")
+
+(org-copy-face 'org-agenda-date 'org-agenda-date-weekend
+              "Face used in agenda for weekend days.
 See the variable `org-agenda-weekend-days' for a definition of which days
-belong to the weekend.")
-  (when (fboundp 'set-face-attribute)
-    (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
+belong to the weekend."
+              :weight 'bold)
+
+(defface org-scheduled
+  (org-compatible-face nil
+    '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
+      (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
+      (((class color) (min-colors 8)) (:foreground "green"))
+      (t (:bold t :italic t))))
+  "Face for items scheduled for a certain day."
+  :group 'org-faces)
 
 (defface org-scheduled-today
   (org-compatible-face nil
@@ -390,6 +535,12 @@ belong to the weekend.")
   "Face for items scheduled for a certain day."
   :group 'org-faces)
 
+(defface org-agenda-dimmed-todo-face
+  '((((background light)) (:foreground "grey50"))
+    (((background dark)) (:foreground "grey50")))
+  "Face used to dimm blocked tasks in the agenda."
+  :group 'org-faces)
+
 (defface org-scheduled-previously
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
@@ -463,7 +614,7 @@ month and 365.24 days for a year)."
   "The number of different faces to be used for headlines.
 Org-mode defines 8 different headline faces, so this can be at most 8.
 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
-  :type 'number
+  :type 'integer
   :group 'org-faces)
 
 (defface org-latex-and-export-specials
@@ -482,6 +633,9 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
   "Face used to highlight math latex and other special exporter stuff."
   :group 'org-faces)
 
+(org-copy-face 'modeline 'org-mode-line-clock
+              "Face used for clock display in mode line.")
+
 (provide 'org-faces)
 
 ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04