[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Scrolling down after Shift-TAB ?

From: François Pinard
Subject: Re: [O] Scrolling down after Shift-TAB ?
Date: Mon, 23 Jan 2012 21:02:25 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (gnu/linux)

Nick Dokos <address@hidden> writes:
> François Pinard <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]