emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: suggestion: display of #+TITLE
Date: Sun, 21 Mar 2010 21:36:23 -0400	[thread overview]
Message-ID: <87sk7tgmso.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <87r5nhr9qr.fsf@stats.ox.ac.uk> (Dan Davison's message of "Thu, 18 Mar 2010 10:21:32 -0400")

Dan Davison <davison@stats.ox.ac.uk> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On Mar 16, 2010, at 5:25 PM, Dan Davison wrote:
>>
>>> Might it be worth considering a special display for the #+title line
>>> in
>>> org buffers?
>>>
>>> Currently it is easy for the title to get buried among more technical
>>> configuration lines like #+options, #+startup, #+seq_toto etc. One can
>>> take the approach of leaving #+title at the top of the document, and
>>> moving the other config lines elesewhere, but even so I am wondering
>>> whether anyone else is attracted by the idea of providing an org-title
>>> display property that would hide the #+title: component, and use an
>>> appropriate face for the title text.
>>>
>>> In some ways, the current state gives the impression that the title is
>>> something which becomes important during export, but is not really a
>>> key
>>> component of document when it is being viewed in emacs. For example, I
>>> expect others are familiar with the experience of exporting an org
>>> file
>>> without a title, finding that the first heading has been used as a
>>> title, and then going back to add in the title as an
>>> afterthought. But a
>>> title is an important part of a document, and I thought perhaps a
>>> special title display would help to make the title more of a first
>>> class
>>> citizen in org buffers?
>>
>> Hi Dan,
>>
>> I agree.  Maybe he same should be true for DATE and AUTHOR, maybe EMAIL?
>>
>> Would you like to make a patch for this, introducing a new face
>> and applying it to these constructs?

[I tried sending this with screenshot images and it got rejected. I've
replaced them with URLs]

I've made a proposed patch (below). This involved making a few decisions
about appearance -- it would be great to get other peoples' views and
alternative proposals.

At the risk of stating the obvious, I think we should ask the question
"What might attract new users to org-mode most?", rather than query our
personal preferences (because we can all change it ourselves or fire off
an email to this list asking how).

Here's my main proposal (corresponding to the patch below). Note that in
the first 4 lines the #+TITLE: and #+AUTHOR: etc bits are still there,
but invisible.

http://www.princeton.edu/~ddavison/org-faces/Default-MidnightBlue.png

The main issue then is that I'm suggesting making the title face larger
than the other faces. This would be the only large face in org-mode, but
I thought that it was appropriate for the title. Here's a version
without the large title face:

http://www.princeton.edu/~ddavison/org-faces/Default-MidnightBlue-NoBigTitle.png

As for the colours, here's an alternative:

http://www.princeton.edu/~ddavison/org-faces/Default-DarkSlateGrey.png

The important thing is the default emacs colour theme shown above, but I
did pick a colour for dark backgrounds. For what it's worth, here is
what it looks like with (the excellent) color-theme-charcoal-black:

http://www.princeton.edu/~ddavison/org-faces/CharcoalBlack-SteelBlue.png

Here's the patch. If anyone wants to play around, it's pretty obvious in
the patch below where to change the colours (and boldness and
height). Don't forget the functions list-colors-display and
list-faces-display.

There's at least one issue with the patch: if you leave a space between
e.g. '#+TITLE:' and the start of the title text, then that space will
not be made invisible and so will appear at the start of the title. I
couldn't see how to avoid that without altering one of the key font-lock
regexps.

Dan

--8<---------------cut here---------------start------------->8---
commit 72aa791ea0bf613d50b9bf88affd6a53e91c1ebe
Author: Dan Davison <davison@stats.ox.ac.uk>
Date:   Sun Mar 21 20:26:02 2010 -0400

    Alter display of title, author, email and date lines.
    
    For each of #+TITLE:, #+AUTHOR:, #+EMAIL:, #+DATE:, the
    initial #+KEYWORD: part is hidden and the following new
    faces are applied to the remaining visible part:
    
    org-title-line
    org-author-line
    org-email-line
    org-date-line

diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index e336b3c..ebc9596 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -468,6 +468,25 @@ changes."
   :group 'org-faces
   :version "22.1")
 
+(defface org-title-line
+  '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44))
+    (((class color) (background dark)) (:foreground "steel blue" :weight bold :height 1.44))
+    (t (:weight bold :height 1.44)))
+  "Face for #+TITLE: line."
+  :group 'org-faces)
+
+(defface org-author-line
+  '((((class color) (background light)) (:foreground "midnight blue"))
+    (((class color) (background dark)) (:foreground "steel blue")))
+  "Face for #+AUTHOR: line."
+  :group 'org-faces)
+
+(org-copy-face 'org-author-line 'org-email-line
+  "Face for #+EMAIL: line.")
+
+(org-copy-face 'org-author-line 'org-date-line
+  "Face for #+DATE: line.")
+
 (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 b723528..17e3877 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4642,6 +4642,22 @@ will be prompted for."
 	       ((string= block-type "verse")
 		(add-text-properties beg1 end1 '(face org-verse))))
 	      t))
+	   ((equal dc1 "title:")
+	    (add-text-properties beg (match-end 3) '(font-lock-fontified t invisible t))
+	    (add-text-properties
+	     (match-beginning 6) (match-end 6) '(font-lock-fontified t face org-title-line)))
+	   ((equal dc1 "author:")
+	    (add-text-properties beg (match-end 3) '(font-lock-fontified t invisible t))
+	    (add-text-properties
+	     (match-beginning 6) (match-end 6) '(font-lock-fontified t face org-author-line)))
+	   ((equal dc1 "email:")
+	    (add-text-properties beg (match-end 3) '(font-lock-fontified t invisible t))
+	    (add-text-properties
+	     (match-beginning 6) (match-end 6) '(font-lock-fontified t face org-email-line)))
+	   ((equal dc1 "date:")
+	    (add-text-properties beg (match-end 3) '(font-lock-fontified t invisible t))
+	    (add-text-properties
+	     (match-beginning 6) (match-end 6) '(font-lock-fontified t face org-date-line)))
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented
 	    (add-text-properties
--8<---------------cut here---------------end--------------->8---




>
> OK, it's on my list.
>
> Dan
>
>>
>> - Carsten
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-03-22  1:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 16:25 suggestion: display of #+TITLE Dan Davison
2010-03-18  6:04 ` Carsten Dominik
2010-03-18 14:21   ` Dan Davison
2010-03-22  1:36     ` Dan Davison [this message]
     [not found]     ` <877hp5i1wl.fsf@stats.ox.ac.uk>
2010-03-24 14:52       ` Carsten Dominik
2010-03-24 20:22         ` Scot Becker
2010-03-26  3:34           ` Dan Davison
2010-03-27 21:34             ` Scot Becker
2010-03-28  2:52               ` Dan Davison
2010-03-28  7:36                 ` Carsten Dominik
2010-03-30  2:04                 ` Thomas S. Dye

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=87sk7tgmso.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=emacs-orgmode@gnu.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).