Bastien <b...@gnu.org> writes:

> User <spamfilteracco...@gmail.com> writes:
>
>> I added the timer, because I didn't know in which order the hooks
>> are run. If org-mode hook runs first and then saveplace's hook
>> which restores point then the above code has no effect.
>
> saveplace adds the hook at the end of the hooks list, by calling
> add-hook like this:
>
>   (add-hook 'find-file-hook 'save-place-find-file-hook t)
>                                                        ^
>
> The `t' means put this hook at the end.
>
> So your org-mode hook will be safely called *before* saveplace's.

Sorry, I mixed up the logic here -- the following hook is okay:

--8<---------------cut here---------------start------------->8---
(add-hook 'org-mode-hook
          (lambda ()
            (when (outline-invisible-p)
              (save-excursion
                (outline-previous-visible-heading 1)
                (org-show-subtree))))
          t)  ;; this makes sure this hook is run last
--8<---------------cut here---------------end--------------->8---

If you load this *after* loading the saveplace hook then it should 
be okay.  Thanks to Nick Dokos for shaking my brain on this :)

-- 
 Bastien


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to