From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Scrolling down after Shift-TAB ? Date: Mon, 23 Jan 2012 19:45:14 -0500 Message-ID: <9681.1327365914@alphaville> References: <87r4yq2dld.fsf@iro.umontreal.ca> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpUVt-0005uJ-Hi for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 19:45:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpUVs-0003J1-9h for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 19:45:29 -0500 Received: from g1t0027.austin.hp.com ([15.216.28.34]:30068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpUVr-0003I7-Lu for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 19:45:28 -0500 In-Reply-To: Message from pinard@iro.umontreal.ca (=?us-ascii?Q?=3D=3Futf-?= =?us-ascii?Q?8=3FQ=3FFran=3DC3=3DA7ois=3F=3D?= Pinard) of "Mon\, 23 Jan 2012 18\:39\:26 EST." <87r4yq2dld.fsf@iro.umontreal.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?us-ascii?Q?=3D=3Futf-8=3FQ=3FFran=3DC3=3DA7?= =?us-ascii?Q?ois=3F=3D?= Pinard Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Fran=C3=A7ois Pinard wrote: > Hi again. >=20 > 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. >=20 > 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: >=20 > - 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. >=20 > - 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. >=20 > - If neither of the above holds, do not automatically scroll. >=20 > Maybe others could improve on this with better ideas or algorithms ? >=20 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