From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitrii Korobeinikov Subject: Re: Preventing org-cycle from scrolling the buffer Date: Fri, 3 Apr 2020 16:41:16 +0600 Message-ID: References: <845zekiluk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000046eeab05a2608f29" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:39195) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKJlT-0002w8-MW for emacs-orgmode@gnu.org; Fri, 03 Apr 2020 06:41:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKJlS-0004Lt-7c for emacs-orgmode@gnu.org; Fri, 03 Apr 2020 06:41:31 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:39075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKJlR-0004L0-Uj for emacs-orgmode@gnu.org; Fri, 03 Apr 2020 06:41:30 -0400 Received: by mail-wr1-x429.google.com with SMTP id p10so7927024wrt.6 for ; Fri, 03 Apr 2020 03:41:29 -0700 (PDT) In-Reply-To: <845zekiluk.fsf@gmail.com> 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: Marco Wahl Cc: emacs-orgmode --00000000000046eeab05a2608f29 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > AFAICS this behavior can be controlled via customizable variable > org-cycle-hook { M-x customize-variable RET org-cycle-hook RET } by > removing entry org-optimize-window-after-visibility-change. Nice, I see! > IDK. AFAICS you are right with your argumentation. I don't see the > need of that feature, though, yet. But that's just me. I think you are > the best candidate to try an implementation of the feature. I have attached a small patch, seems to be working! Of course, if this is to be merged, that defvar will have to turn into a defcustom. Best, DK =D0=B2=D1=82, 31 =D0=BC=D0=B0=D1=80. 2020 =D0=B3. =D0=B2 21:29, Marco Wahl = : > > Dmitrii Korobeinikov writes: > > When calling org-cycle on a collapsed section which contains a lot of > > text, the headline is adjusted to the top of the page. Collapsing it > > doesn't revert the scroll, which makes it hard to quickly peek at > > what's in the section without getting disoriented. Is there a flag or > > some other way of turning off this autoscroll? > > AFAICS this behavior can be controlled via customizable variable > org-cycle-hook { M-x customize-variable RET org-cycle-hook RET } by > removing entry org-optimize-window-after-visibility-change. > > > Scroll revert wouldn't be so bad to have either, by the way (in > > addition to, not instead of, though). Since org knows when the cursor > > moves away from the headline after tabbing, it seems this feature can > > be implemented without too much hassle. I would even go as far as to > > suggest making it a default if it gets done. > > > > What do you think? > > IDK. AFAICS you are right with your argumentation. I don't see the > need of that feature, though, yet. But that's just me. I think you are > the best candidate to try an implementation of the feature. > > > Best regards, > -- Marco --00000000000046eeab05a2608f29 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-org.el-Add-an-option-to-restore-scroll-position-when.patch" Content-Disposition: attachment; filename="0001-org.el-Add-an-option-to-restore-scroll-position-when.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k8k1rmt30 RnJvbSBlZTk4MjZmNjI2OThiMmU1ZDIwMGZkZjkwYTk2M2RkZDc1MWFkNjc5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEbWl0cmlpIEtvcm9iZWluaWtvdiA8ZGltMTIxMmtAZ21haWwu Y29tPgpEYXRlOiBGcmksIDMgQXByIDIwMjAgMTY6MTk6MzMgKzA2MDAKU3ViamVjdDogW1BBVENI XSBvcmcuZWw6IEFkZCBhbiBvcHRpb24gdG8gcmVzdG9yZSBzY3JvbGwgcG9zaXRpb24gd2hlbgog Y29sbGFwc2luZyBhIHRyZWUKCiogbGlzcC9vcmcuZWwgKG9yZy1vcHRpbWl6ZS13aW5kb3ctYWZ0 ZXItdmlzaWJpbGl0eS1jaGFuZ2UpOiB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