From 9c09a85ab62ec6921536b4f25132545d7502507d Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 28 Mar 2010 10:39:47 -0400 Subject: [PATCH] New faces for title, date, author and email address lines. By default, title, author, date and email lines appear in dark blue with the initial keywords greyed out. The title is in a larger font than the others. This is implemented by the following new faces: org-document-title org-document-info org-document-info-keyword In addition, the variable org-hidden-keywords can be used to make the corresponding keywords disappear. --- lisp/ChangeLog | 12 ++++++++++++ lisp/org-faces.el | 28 ++++++++++++++++++++++++++++ lisp/org.el | 22 ++++++++++++++++++++++ 3 files changed, 62 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e492ad314..a027996a5 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2010-03-28 Dan Davison + + * org.el (org-hidden-keywords): New customizable variable. This is + a list of symbols specifying which of the special keywords #+DATE, + #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. + (org-fontify-meta-lines-and-blocks): Changes to font-lock code + implementing new faces and hiding behaviour. + + * org-faces.el (org-document-title): New face for #+TITLE lines + (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines + (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords + 2010-03-28 Carsten Dominik * org-publish.el (org-publish-sanitize-plist): New function to diff --git a/lisp/org-faces.el b/lisp/org-faces.el index e336b3cd6..8ec7ce136 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -468,6 +468,34 @@ changes." :group 'org-faces :version "22.1") +(defface org-document-title + '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44)) + (((class color) (background dark)) (:foreground "pale turquoise" :weight bold :height 1.44)) + (t (:weight bold :height 1.44))) + "Face for document title, i.e. that which follows the #+TITLE: keyword." + :group 'org-faces) + +(defface org-document-info + '((((class color) (background light)) (:foreground "midnight blue")) + (((class color) (background dark)) (:foreground "pale turquoise")) + (t nil)) + "Face for document date, author and email; i.e. that which +follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword." + :group 'org-faces) + +(defface org-document-info-keyword + (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 for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords." + :group 'org-faces) + (defface org-block (org-compatible-face 'shadow '((((class color grayscale) (min-colors 88) (background light)) diff --git a/lisp/org.el b/lisp/org.el index dad864982..e30c49a7b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2975,6 +2975,17 @@ lines to the buffer: :group 'org-font-lock :type 'boolean) +(defcustom org-hidden-keywords nil + "List of keywords that should be hidden when typed in the org buffer. +For example, add #+TITLE to this list in order to make the +document title appear in the buffer without the initial #+TITLE: +keyword." + :group 'org-font-lock + :type '(set (const :tag "#+AUTHOR" author) + (const :tag "#+DATE" date) + (const :tag "#+EMAIL" email) + (const :tag "#+TITLE" title))) + (defcustom org-fontify-done-headline nil "Non-nil means change the face of a headline if it is marked DONE. Normally, only the TODO/DONE keyword indicates the state of a headline. @@ -4681,6 +4692,17 @@ will be prompted for." ((string= block-type "verse") (add-text-properties beg1 end1 '(face org-verse)))) t)) + ((member dc1 '("title:" "author:" "email:" "date:")) + (add-text-properties + beg (match-end 3) + (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) + '(font-lock-fontified t invisible t) + '(font-lock-fontified t face org-document-info-keyword))) + (add-text-properties + (match-beginning 6) (match-end 6) + (if (string-equal dc1 "title:") + '(font-lock-fontified t face org-document-title) + '(font-lock-fontified t face org-document-info)))) ((not (member (char-after beg) '(?\ ?\t))) ;; just any other in-buffer setting, but not indented (add-text-properties