emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Highlighting current header and its contents
@ 2010-03-21 15:51 Tom
  2010-03-21 17:59 ` Dan Davison
  0 siblings, 1 reply; 3+ messages in thread
From: Tom @ 2010-03-21 15:51 UTC (permalink / raw)
  To: emacs-orgmode

One of my main gripes with orgmode is often I cannot make out
clearly when the text content of an opened header ends and the
next header begins, because there is no apparent visual
indication.

Of course, I can add empty lines manually to the end of the
content, but this solution is not really satisfying (I don't need
empty lines there, I add them only to see better where the
content ends).

I'm still thinking of a proper solution for this problem, but I'm
posting one of my attempts for the time being which some may find
useful. It highlights the header the cursor is in and its contents with a
different background color:


(make-variable-buffer-local 'my-org-highlight-overlay)

(add-hook 'post-command-hook 'my-org-highlight)


(defun my-org-highlight ()
  (when (and (eq major-mode 'org-mode)
             (sit-for 0.1))
    (unless my-org-highlight-overlay
      (setq my-org-highlight-overlay (make-overlay 0 0))
      (overlay-put my-org-highlight-overlay 'face '(:background "azure")))

    (let ((header (save-excursion
                    (beginning-of-line)
                    (looking-at outline-regexp))))

      (move-overlay my-org-highlight-overlay
                    (save-excursion
                      (if header
                          (beginning-of-line)
                        (outline-previous-visible-heading 1))
                      (point))
                    (save-excursion
                      (outline-next-visible-heading 1)
                      (point))))))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Highlighting current header and its contents
  2010-03-21 15:51 Highlighting current header and its contents Tom
@ 2010-03-21 17:59 ` Dan Davison
  2010-03-21 18:22   ` Tom
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Davison @ 2010-03-21 17:59 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode

Tom <levelhalom@gmail.com> writes:

> One of my main gripes with orgmode is often I cannot make out
> clearly when the text content of an opened header ends and the
> next header begins, because there is no apparent visual
> indication.
>
> Of course, I can add empty lines manually to the end of the
> content, but this solution is not really satisfying (I don't need
> empty lines there, I add them only to see better where the
> content ends).
>
> I'm still thinking of a proper solution for this problem, but I'm
> posting one of my attempts for the time being which some may find
> useful. It highlights the header the cursor is in and its contents with a
> different background color:

Hi Tom,

Your overlay code's instructive for me, but I don't understand the
problem it's solving. Isn't the next heading made sufficiently distinct
by being bold and coloured and having an asterisk in front of it?

Dan

>
>
> (make-variable-buffer-local 'my-org-highlight-overlay)
>
> (add-hook 'post-command-hook 'my-org-highlight)
>
>
> (defun my-org-highlight ()
>   (when (and (eq major-mode 'org-mode)
>              (sit-for 0.1))
>     (unless my-org-highlight-overlay
>       (setq my-org-highlight-overlay (make-overlay 0 0))
>       (overlay-put my-org-highlight-overlay 'face '(:background "azure")))
>
>     (let ((header (save-excursion
>                     (beginning-of-line)
>                     (looking-at outline-regexp))))
>
>       (move-overlay my-org-highlight-overlay
>                     (save-excursion
>                       (if header
>                           (beginning-of-line)
>                         (outline-previous-visible-heading 1))
>                       (point))
>                     (save-excursion
>                       (outline-next-visible-heading 1)
>                       (point))))))
>
>
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Highlighting current header and its contents
  2010-03-21 17:59 ` Dan Davison
@ 2010-03-21 18:22   ` Tom
  0 siblings, 0 replies; 3+ messages in thread
From: Tom @ 2010-03-21 18:22 UTC (permalink / raw)
  To: emacs-orgmode

Dan Davison <davison <at> stats.ox.ac.uk> writes:
> 
> Your overlay code's instructive for me, but I don't understand the
> problem it's solving. Isn't the next heading made sufficiently distinct
> by being bold and coloured and having an asterisk in front of it?
> 

Not really. My headings are not bold, because it's too heavy for
the eyes when several headings without content follow each
other. Too much boldness. :)

The color and the asterisk sometimes melt into the surroundings
when there is lots of text before it. Not distinctive enough.

The problem is I don't want to make headers too distinctive,
because when I use lots of empty headers below each other then I
don't want them to glow in my face. On the other hand, when
headings have text content then it should be separated clearly
from the surrounding headings.

Clearly, others have similar problems with it judging from the lots of
possible values of org-cycle-separator-lines.

But it's subjective, of course.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-21 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-21 15:51 Highlighting current header and its contents Tom
2010-03-21 17:59 ` Dan Davison
2010-03-21 18:22   ` Tom

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