emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: =?utf-8?Q?Fran=C3=A7ois?= Pinard <pinard@iro.umontreal.ca>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Scrolling down after Shift-TAB ?
Date: Mon, 23 Jan 2012 19:45:14 -0500	[thread overview]
Message-ID: <9681.1327365914@alphaville> (raw)
In-Reply-To: Message from pinard@iro.umontreal.ca (=?utf-8?Q?Fran=C3=A7ois?= Pinard) of "Mon\, 23 Jan 2012 18\:39\:26 EST." <87r4yq2dld.fsf@iro.umontreal.ca>

François Pinard <pinard@iro.umontreal.ca> wrote:

> Hi again.
> 
> Very, very often, after a Shift-TAB that collapses all entries, a few
> lines in the vicinity of the cursor are shown at the top of the window,
> which is mainly empty for its reminder; we contemplate the vacuum
> *after* the file.  As my Org files are such that all the top level lines
> usually fit in one window, I then invariably scroll down so see it all.
> 
> I wonder if this could be automated, yet it is a bit uneasy to exactly
> define what would be the ideal.  Let me try an initial suggestion:
> 
> - If the whole Org file could be displayed at once, scrolling should
>   automatically occur so the first line of the window displays the
>   beginning of the Org file.
> 
> - Otherwise, if the last line of the window would be *outside* the Org
>   file, scrolling should automatically occur so the last line of the
>   window displays the end of the Org file.
> 
> - If neither of the above holds, do not automatically scroll.
> 
> Maybe others could improve on this with better ideas or algorithms ?
> 

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.

Have you tried C-l after the collapse? S-TAB C-l doesn't do quite what
you specified, but perhaps it's enough: it shrinks the vacuum after the
file, maybe to nothing, and it does not shift point. If you like
the behavior, you can always advise org-cycle so that it always calls
recenter afterwards:

--8<---------------cut here---------------start------------->8---
(defadvice  org-cycle (after org-cycle-recenter)
  "Recenter after org-cycle)"
  (recenter))

(ad-activate 'org-cycle)
--8<---------------cut here---------------end--------------->8---

Nick

  reply	other threads:[~2012-01-24  0:45 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 [this message]
2012-01-24  2:02   ` François Pinard
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=9681.1327365914@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pinard@iro.umontreal.ca \
    /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).