Nick Dokos <nicholas.do...@hp.com> writes: > François Pinard <pin...@iro.umontreal.ca> wrote:
>> Very, very often, after a Shift-TAB that collapses all entries, [...] >> I [...] scroll down so see it all. > You'd need to code it somewhat carefully sp that you wouldn't lose the > property that after a couple of S-TABs, the buffer looks the same as > when you started and point has not moved: that's useful in order to zoom > out and orient yourself in the larger context and then zoom in again to > continue working. That's a nice property indeed. Thanks for your patience with me! :-) > Have you tried C-l after the collapse? It usually does not do the proper thing alone, but `C-l C-l C-l' is closer to what I want. > If you like the behavior, you can always advise org-cycle so that it > always calls recenter afterwards: > (defadvice org-cycle (after org-cycle-recenter) > "Recenter after org-cycle)" > (recenter)) > (ad-activate 'org-cycle) This was a good hint, thanks. Starting from your idea, I ended up with: (defun fp-org-cycle-recenter (type) "Recenter after global collapsing." (when (eq type 'overview) (recenter (1- (window-body-height))))) (add-hook 'org-cycle-hook 'fp-org-cycle-recenter) When returning to a more expanded view, the original line is recovered at the center of the window instead of at its precise previous position, which is quite acceptable to me. From there, another full cycle of course leaves the impression that the position did not move. François