From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Highlighting current header and its contents Date: Sun, 21 Mar 2010 13:59:06 -0400 Message-ID: <87zl211rpx.fsf@stats.ox.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtPQj-0006aP-J5 for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 13:59:17 -0400 Received: from [140.186.70.92] (port=49515 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtPQi-0006a5-9E for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 13:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtPQe-0000aM-Pa for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 13:59:16 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:39244) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtPQe-0000aF-Hf for emacs-orgmode@gnu.org; Sun, 21 Mar 2010 13:59:12 -0400 In-Reply-To: (Tom's message of "Sun, 21 Mar 2010 15:51:54 +0000 (UTC)") 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: Tom Cc: emacs-orgmode@gnu.org Tom 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