On Thu, Mar 17, 2011 at 12:27 AM, Le Wang <l26w...@gmail.com> wrote:

> Yes, I didn't know about `org-reveal'.  That could work.  But how do I
> figure out if I need to expand the heading?  The last change could be to a
> folded heading itself, in which case, it shouldn't be expanded.
>
> Is there a org-goto-char type of function that always goes to that location
> in the buffer, expanding sections along the way?


I've solved it by advising goto-char like so:

(defadvice goto-char (around org-expand activate compile)
  (if (eq major-mode 'org-mode)
      (progn
        ad-do-it
        (org-reveal)
        ad-do-it)
    ad-do-it))

Can anyone see any problems with advising such a fundamental function?

-- 
Le

Reply via email to