all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to achieve desired automatic scrolling behavior
@ 2013-05-17 16:24 Barry OReilly
  2013-05-17 23:37 ` Bob Proulx
  0 siblings, 1 reply; 11+ messages in thread
From: Barry OReilly @ 2013-05-17 16:24 UTC (permalink / raw)
  To: help-gnu-emacs

For the most part, I want the behavior of scroll-conservatively 1, where
navigating line by line doesn't recenter, but jumping to a different part
of the buffer does.

One jarring behavior I wish to customize away is when going line by line
across a line that wraps visually, the behavior is to recenter. How do I
have it not recenter in this case?

Also desirable is when scroll-conservatively==1 would cause a recenter, it
would instead use the scroll-*-aggressively setting. Setting both of these
does not have that effect.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-17 16:24 Barry OReilly
@ 2013-05-17 23:37 ` Bob Proulx
  0 siblings, 0 replies; 11+ messages in thread
From: Bob Proulx @ 2013-05-17 23:37 UTC (permalink / raw)
  To: Barry OReilly; +Cc: help-gnu-emacs

Barry OReilly wrote:
> For the most part, I want the behavior of scroll-conservatively 1, where
> navigating line by line doesn't recenter, but jumping to a different part
> of the buffer does.
> 
> One jarring behavior I wish to customize away is when going line by line
> across a line that wraps visually, the behavior is to recenter. How do I
> have it not recenter in this case?
> 
> Also desirable is when scroll-conservatively==1 would cause a recenter, it
> would instead use the scroll-*-aggressively setting. Setting both of these
> does not have that effect.

The current knowledge and wisdom concerning this topic is documented
here on this wiki page.  Start there.  Then if things still don't work
come back and describe what you have tried.

  http://www.emacswiki.org/emacs/SmoothScrolling

Bob



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
       [not found] <mailman.26006.1368807846.855.help-gnu-emacs@gnu.org>
@ 2013-05-25 16:37 ` Javier
  2013-05-25 19:06   ` Emanuel Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Javier @ 2013-05-25 16:37 UTC (permalink / raw)
  To: help-gnu-emacs


I don't understand exactly what kind of behavoiur you want, but here's
what is in my .emacs to scroll line by line when I am in the top/bootm
of the screen and press arrow up/down:

; scroll line by line
(progn (setq scroll-step 1)
       (setq scroll-preserve-screen-position t)
       (setq scroll-conservatively 9999))


Barry OReilly <gundaetiapo@gmail.com> wrote:
> For the most part, I want the behavior of scroll-conservatively 1, where
> navigating line by line doesn't recenter, but jumping to a different part
> of the buffer does.
> 
> One jarring behavior I wish to customize away is when going line by line
> across a line that wraps visually, the behavior is to recenter. How do I
> have it not recenter in this case?
> 
> Also desirable is when scroll-conservatively==1 would cause a recenter, it
> would instead use the scroll-*-aggressively setting. Setting both of these
> does not have that effect.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-25 16:37 ` Javier
@ 2013-05-25 19:06   ` Emanuel Berg
  0 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2013-05-25 19:06 UTC (permalink / raw)
  To: help-gnu-emacs

Javier <nospam@nospam.com> writes:

> I don't understand exactly what kind of behavoiur you want

Me neither, maybe you (the OP) could describe it once more?

> but here's what is in my .emacs to scroll line by line when I am in
> the top/bootm of the screen and press arrow up/down:

Why not scroll with point, with C-p and C-n? That way, you won't have
to reach for the arrow keys, and then back again, to get back to
typing. Hit C-l (sometimes more than once) to get to the window
fringe, the scroll.

Scrolling without moving point is sometimes useful, but even then, in
my mind, no shortcuts should be disruptive to typing. Never leave F
and J!

Also, lots of scrolling (particularly of source code) could be
replaced by searching. Searching is called "search" (with various
modifiers attached), but as for my usage, I would rather call it
"navigate".

> ; scroll line by line
> (progn (setq scroll-step 1)
>        (setq scroll-preserve-screen-position t)
>        (setq scroll-conservatively 9999))

OK, here goes "mine" as well, for civilized scrolling (as someone
said, and I agree) -

(setq scroll-step 1)
(setq scroll-conservatively 10000)
(setq auto-window-vscroll nil)

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
@ 2013-05-29 13:57 Barry OReilly
  2013-05-29 15:34 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Barry OReilly @ 2013-05-29 13:57 UTC (permalink / raw)
  To: help-gnu-emacs

> Me neither, maybe you (the OP) could describe it once more?

I'm asking about two things, but I'll focus on the first. The simplest way
to describe it: if a command moves point by line off screen, I want to
scroll one line and if point moves more than that off screen, I want to
recenter point.

One would think scroll-conservatively==1 would fit the bill, but it doesn't
when lines wrap. If I arrow down (actually: Evil's j command) I'm fine
until I hit a line that wraps visually, then I get an undesired recenter.
This makes scroll-conservatively==1 practically useless when lines wrap
visually.

Another approach I tried, which might actually give better edge case
behavior* if it worked:
  Customize scroll-conservatively to 0
  Advise line-move:
    (defadvice line-move (around my-advice-line-move activate)
      (let ((scroll-conservatively 101))
        ad-do-it))

That doesn't work; moving by lines has scroll-conservatively==0 behavior.

* eg if I search on a term and the next search term is in the line just
below what's visible.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-29 13:57 How to achieve desired automatic scrolling behavior Barry OReilly
@ 2013-05-29 15:34 ` Eli Zaretskii
  2013-05-29 15:55   ` Frank Fischer
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2013-05-29 15:34 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 29 May 2013 09:57:32 -0400
> From: Barry OReilly <gundaetiapo@gmail.com>
> 
> I'm asking about two things, but I'll focus on the first. The simplest way
> to describe it: if a command moves point by line off screen, I want to
> scroll one line and if point moves more than that off screen, I want to
> recenter point.
> 
> One would think scroll-conservatively==1 would fit the bill, but it doesn't
> when lines wrap. If I arrow down (actually: Evil's j command) I'm fine
> until I hit a line that wraps visually, then I get an undesired recenter.

I don't understand why: did you disable visual-line-mode (it is ON by
default)?  Or maybe Evil does something with the related commands and
features?  Because by default, pressing the down arrow key once moves
1 _screen_ line down, which still fits the scroll-conservatively==1
condition, and should give you the behavior you want.

I just tried what I think you are doing, when lines are wrapped, and
didn't have any recentering.  How about a recipe to reproduce this
starting from "emacs -Q"?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-29 15:34 ` Eli Zaretskii
@ 2013-05-29 15:55   ` Frank Fischer
  0 siblings, 0 replies; 11+ messages in thread
From: Frank Fischer @ 2013-05-29 15:55 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Wed, 29 May 2013 09:57:32 -0400
>> From: Barry OReilly <gundaetiapo@gmail.com>
>> 
>> One would think scroll-conservatively==1 would fit the bill, but it doesn't
>> when lines wrap. If I arrow down (actually: Evil's j command) I'm fine
>> until I hit a line that wraps visually, then I get an undesired recenter.
>
> I don't understand why: did you disable visual-line-mode (it is ON by
> default)?  Or maybe Evil does something with the related commands and
> features?  Because by default, pressing the down arrow key once moves
> 1 _screen_ line down, which still fits the scroll-conservatively==1
> condition, and should give you the behavior you want.

By default, Evil's "j" command moves by "physical" lines, not be screen
lines even if visual-line-mode is enabled. Please use "gj" instead (or
rebind "j", e.g. (define-key evil-motion-mode-map "j" "gj")).

Best regards,
Frank




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
@ 2013-05-29 23:02 Barry OReilly
  2013-05-30 14:45 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Barry OReilly @ 2013-05-29 23:02 UTC (permalink / raw)
  To: help-gnu-emacs

> By default, Evil's "j" command moves by "physical" lines, not be screen
> lines even if visual-line-mode is enabled. Please use "gj" instead (or
> rebind "j", e.g. (define-key evil-motion-mode-map "j" "gj")).

Thanks, that improves the behavior of scroll-conservatively quite a bit.

> I just tried what I think you are doing, when lines are wrapped, and
> didn't have any recentering.  How about a recipe to reproduce this
> starting from "emacs -Q"?

After Frank's fix, there's still an issue with recentering during line by
line scrolling with scroll-conservatively==1, so I submitted a bug report.

> Customize scroll-conservatively to 0
> Advise line-move:
>   (defadvice line-move (around my-advice-line-move activate)
>     (let ((scroll-conservatively 101))
>       ad-do-it))

Why does the let bound scroll-conservatively not seem to take effect for
the around advice?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-29 23:02 Barry OReilly
@ 2013-05-30 14:45 ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2013-05-30 14:45 UTC (permalink / raw)
  To: help-gnu-emacs

>> Customize scroll-conservatively to 0
>> Advise line-move:
>> (defadvice line-move (around my-advice-line-move activate)
>> (let ((scroll-conservatively 101))
>> ad-do-it))

> Why does the let bound scroll-conservatively not seem to take effect for
> the around advice?

Because the scroll does not happen during the line-move but after it
(line-move just moves point, and once the command is complete,
a redisplay is triggered to reflect the change on screen, at which
point the redisplay code notices that point is "outside the window"
and triggers a scroll to bring it back into view).


        Stefan




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
@ 2013-05-30 18:23 Barry OReilly
  2013-05-30 19:08 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Barry OReilly @ 2013-05-30 18:23 UTC (permalink / raw)
  To: help-gnu-emacs

> Because the scroll does not happen during the line-move but after it
> (line-move just moves point, and once the command is complete,
> a redisplay is triggered to reflect the change on screen, at which
> point the redisplay code notices that point is "outside the window"
> and triggers a scroll to bring it back into view).

Oh. I suppose that might explain bug 14508 [1], if more than one line-move
can get processed before a redisplay is triggered. Where is redisplay
triggered from?

[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14508


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to achieve desired automatic scrolling behavior
  2013-05-30 18:23 Barry OReilly
@ 2013-05-30 19:08 ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2013-05-30 19:08 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 30 May 2013 14:23:17 -0400
> From: Barry OReilly <gundaetiapo@gmail.com>
> 
> > Because the scroll does not happen during the line-move but after it
> > (line-move just moves point, and once the command is complete,
> > a redisplay is triggered to reflect the change on screen, at which
> > point the redisplay code notices that point is "outside the window"
> > and triggers a scroll to bring it back into view).
> 
> Oh. I suppose that might explain bug 14508 [1], if more than one line-move
> can get processed before a redisplay is triggered.

Yes.  Although I'm not sure that is what happens in that bug.

> Where is redisplay triggered from?

Normally, as a side effect of Emacs being idle.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-05-30 19:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29 13:57 How to achieve desired automatic scrolling behavior Barry OReilly
2013-05-29 15:34 ` Eli Zaretskii
2013-05-29 15:55   ` Frank Fischer
  -- strict thread matches above, loose matches on Subject: below --
2013-05-30 18:23 Barry OReilly
2013-05-30 19:08 ` Eli Zaretskii
2013-05-29 23:02 Barry OReilly
2013-05-30 14:45 ` Stefan Monnier
     [not found] <mailman.26006.1368807846.855.help-gnu-emacs@gnu.org>
2013-05-25 16:37 ` Javier
2013-05-25 19:06   ` Emanuel Berg
2013-05-17 16:24 Barry OReilly
2013-05-17 23:37 ` Bob Proulx

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.