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.
This commit is contained in:
Dan Davison 2010-03-28 10:39:47 -04:00
parent 7455e6c285
commit 9c09a85ab6
3 changed files with 62 additions and 0 deletions

View file

@ -1,3 +1,15 @@
2010-03-28 Dan Davison <davison@stats.ox.ac.uk>
* 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 <carsten.dominik@gmail.com>
* org-publish.el (org-publish-sanitize-plist): New function to

View file

@ -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))

View file

@ -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