From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Subject: Highlighting current header and its contents Date: Sun, 21 Mar 2010 15:51:54 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtNRl-0003h4-3P for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 11:52:13 -0400 Received: from [140.186.70.92] (port=37008 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtNRj-0003gw-NK for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 11:52:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtNRi-0007yq-HY for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 11:52:11 -0400 Received: from lo.gmane.org ([80.91.229.12]:56639) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtNRi-0007yk-Bh for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 11:52:10 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NtNRg-00072c-4u for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 16:52:08 +0100 Received: from 94-21-239-107.pool.digikabel.hu ([94.21.239.107]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Mar 2010 16:52:08 +0100 Received: from levelhalom by 94-21-239-107.pool.digikabel.hu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Mar 2010 16:52:08 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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))))))