[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: Showing hidden subtree automatically if point is hidde
From: |
Bastien |
Subject: |
Re: [Orgmode] Re: Showing hidden subtree automatically if point is hidden when the buffer is opened |
Date: |
Wed, 29 Jul 2009 02:27:41 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
Bastien <address@hidden> writes:
> User <address@hidden> 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