emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pinard@iro.umontreal.ca (François Pinard)
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Scrolling down after Shift-TAB ?
Date: Mon, 23 Jan 2012 21:02:25 -0500	[thread overview]
Message-ID: <87sjj526z2.fsf@iro.umontreal.ca> (raw)
In-Reply-To: <9681.1327365914@alphaville> (Nick Dokos's message of "Mon, 23 Jan 2012 19:45:14 -0500")

Nick Dokos <nicholas.dokos@hp.com> writes:
> François Pinard <pinard@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

  reply	other threads:[~2012-01-24  2:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 23:39 Scrolling down after Shift-TAB ? François Pinard
2012-01-24  0:45 ` Nick Dokos
2012-01-24  2:02   ` François Pinard [this message]
2012-01-24  2:33     ` Nick Dokos
2012-01-24 12:14       ` François Pinard
2012-01-24 12:15       ` François Pinard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjj526z2.fsf@iro.umontreal.ca \
    --to=pinard@iro.umontreal.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).