all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org
Subject: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor
Date: Thu, 16 Oct 2014 23:28:47 +0300	[thread overview]
Message-ID: <83d29r3gjk.fsf@gnu.org> (raw)
In-Reply-To: <jwvzjcvq56u.fsf-monnier+emacsbugs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: josh+gnu@nispio.net,  18739@debbugs.gnu.org
> Date: Thu, 16 Oct 2014 15:28:23 -0400
> 
> >> So, could we say that this hook is supposed to be run if and only if
> >> the window-start marker is changed?
> > I don't think so, because set-window-buffer and split-window-internal
> > run the hook unconditionally, i.e. they don't check whether the
> > window-start changed.
> 
> If the marker used to point into another buffer, it is clearly changed,
> so the only problem is that the hook may be run a few more times than
> necessary, e.g. if you set-window-buffer to the buffer that's already
> displayed in that window.

Those few more times are in direct contradiction to the definition you
suggested.  If you don't care about that, what would be the purpose of
the definition?

> >> E.g. it is not called if the only change is that text has been
> >> inserted before window-start (hence the numeric value of
> >> window-start would be changed, but the marker still points to the
> >> same place).
> > As long as the old window-start is valid and point is in view, I don't
> > think the hook will be called, no.
> 
> Good.  Consistent with my definition.
> 
> > But note that inserting text before window-start could cause
> > scrolling, if window-start was originally in a continued line, or if
> > text was added at the beginning of the line that was the window-start.
> 
> Right, in which case window-start would be modified by the redisplay in
> order to perform the scrolling and window-scroll-functions would be run,
> right?  So, again, consistent with my definition.

Sorry, I'm lost.  I no longer understand what "consistency" is being
praised here.  For that matter, I probably don't understand what you
mean by window-start "modified" and "unmodified", as you seem to
employ contradicting meanings: one when the marker moves but points to
the same text, the other when it doesn't move, but points to a
different text.

> >> Do you happen to know where is the C code that changes point
> >> (in response to scrolling) in the redisplay?
> > The part that begins under the force_start label in redisplay_window,
> > and is conditioned by the window's force_start flag.
> 
> Right, I see it (in xdisp.c) after the comment that says:
> 
>       /* If we need to move point for either of the above reasons,
> 	 now actually do it.  */
> 
> Playing with it, I see that this code is triggered very rarely.

As it should be.  It is mainly meant for scrolling commands.

> `scroll-up' doesn't go through this at all.

scroll-up calls window_scroll, which calls window_scroll_pixel_based,
which does set the force_start flag of the window, and thus does
trigger this portion of redisplay_window.

The force_start flag is _the_ way by which scrolling commands work:
they tell redisplay to heed to what they did.

> We also "set point in response to scrolling" in window_scroll_line_based
> and in window_scroll_pixel_based.

Which are called by scroll-up etc.

> There might be others.

Should be mostly (or only) scrolling commands.





  reply	other threads:[~2014-10-16 20:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15 18:51 bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Josh
2014-10-15 20:43 ` Eli Zaretskii
2014-10-15 21:01   ` Josh
2014-10-15 21:08     ` Eli Zaretskii
2014-10-15 21:12       ` Josh Hunsaker
2014-10-15 21:27         ` Ivan Shmakov
2014-10-16  6:36         ` Eli Zaretskii
2014-10-16  7:15           ` Andreas Schwab
2014-10-16  7:33             ` Eli Zaretskii
2014-10-16  7:38               ` Andreas Schwab
2014-10-16  7:50                 ` Eli Zaretskii
2014-10-15 22:48   ` Stefan Monnier
2014-10-16  6:41     ` Eli Zaretskii
2014-10-16 13:44       ` Stefan Monnier
2014-10-16 13:53         ` Josh
2014-10-16 14:25           ` Eli Zaretskii
2014-10-16 14:35             ` Josh
2014-10-16 14:46               ` Eli Zaretskii
2014-10-16 14:58                 ` Josh
2014-10-16 15:00                   ` Eli Zaretskii
2022-04-27 18:45                   ` Lars Ingebrigtsen
2014-10-16 14:13         ` Eli Zaretskii
2014-10-16 15:13           ` Stefan Monnier
2014-10-16 15:32             ` Josh
2014-10-16 15:54             ` Eli Zaretskii
2014-10-16 19:28               ` Stefan Monnier
2014-10-16 20:28                 ` Eli Zaretskii [this message]
2014-10-16 21:24                   ` Stefan Monnier
2014-10-17  6:38                     ` Eli Zaretskii
2014-10-17 13:04                       ` Stefan Monnier
2014-10-17 13:16                         ` Eli Zaretskii
2014-10-17 17:02                           ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=83d29r3gjk.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=18739@debbugs.gnu.org \
    --cc=josh+gnu@nispio.net \
    --cc=monnier@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 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.