bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32863: Unsatisfactory "definition" of "vertical scroll position" in


From: Alan Mackenzie
Subject: bug#32863: Unsatisfactory "definition" of "vertical scroll position" in Emacs lisp manual and doc string of window-vscroll
Date: Mon, 15 Oct 2018 11:48:03 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Eli.

Thanks very much for the explanations.

On Sat, Sep 29, 2018 at 00:41:54 +0300, Eli Zaretskii wrote:
> > Date: Fri, 28 Sep 2018 15:28:32 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > In the Emacs-26.1 Emacs Lisp manual, on page "Vertical Scrolling" there
> > is an ostensible definition for "vertical scroll position".

> > This "definition" says it "is a number, never less than zero.  It
> > specifies how far to raise the contents of the window."

> > What should be doing this raising?

> The call to set-window-vscroll does that.

> > When might it do this?

> The automatic calls to set-window-vscroll happen when a screen line is
> too tall to be completely visible in a window, and Emacs is asked to
> scroll.  Try scrolling or vertical motion commands when the window
> displays a tall image.

> > For what purpose might the contents of the window be raised?

> To show the portion of the current line that is not currently visible.

> > I find this "definition" totally obscure.  I can not make sense of it at
> > all.  Without understanding what "vertical scroll position" means, the
> > entire manual page is meaningless.

> Do you understand it now?

Yes, I do.  :-)

> > I came to this manual page through not understanding the doc string for
> > the function window-vscroll.  This says just "Return the amount by which
> > WINDOW is scrolled vertically.".

> > _Is_ scrolled vertically.  What on earth does that mean?

> See above.

> > What is the zero point from which this scrolling is measured?

> The zero point is when the top pixel of the window's first screen line
> is visible.

> > Does this "is" refer to the current visible scrolling, or the
> > intended scrolling after the next redisplay?

> Since redisplay runs when Emacs is idle, the answer should be obvious,
> right?

> > This doc string needs clarification.

> I'm all ears.

I propose to amend windows.texi, and two doc strings in windows.c in the
emacs-26 branch as follows.  I think that these amendments would have
prevented my initial puzzlement.  Any comments?


diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 265067146d..32546c544d 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -4200,18 +4200,19 @@ Vertical Scrolling
 @cindex vertical scroll position
 
    @dfn{Vertical fractional scrolling} means shifting text in a window
-up or down by a specified multiple or fraction of a line.  Each window
+up or down by a specified multiple or fraction of a line.  Emacs uses it
+on images and text rows which are taller than the window.  Each window
 has a @dfn{vertical scroll position}, which is a number, never less than
-zero.  It specifies how far to raise the contents of the window.
-Raising the window contents generally makes all or part of some lines
-disappear off the top, and all or part of some other lines appear at the
-bottom.  The usual value is zero.
+zero.  It specifies how far to raise the contents of the window when
+redisplaying it.  Raising the window contents generally makes all or
+part of some lines disappear off the top, and all or part of some other
+lines appear at the bottom.  The usual value is zero.
 
    The vertical scroll position is measured in units of the normal line
 height, which is the height of the default font.  Thus, if the value is
-.5, that means the window contents are scrolled up half the normal line
-height.  If it is 3.3, that means the window contents are scrolled up
-somewhat over three times the normal line height.
+.5, that means the window contents will be scrolled up half the normal
+line height.  If it is 3.3, that means the window contents are scrolled
+up somewhat over three times the normal line height.
 
    What fraction of a line the vertical scrolling covers, or how many
 lines, depends on what the lines contain.  A value of .5 could scroll a
diff --git a/src/window.c b/src/window.c
index 409b01f302..0f784db77f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7322,6 +7322,8 @@ value.  */)
 
 DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
        doc: /* Return the amount by which WINDOW is scrolled vertically.
+This takes effect when redisplaying tall lines or images.
+
 If WINDOW is omitted or nil, it defaults to the selected window.
 Normally, value is a multiple of the canonical character height of WINDOW;
 optional second arg PIXELS-P means value is measured in pixels.  */)
@@ -7344,6 +7346,8 @@ optional second arg PIXELS-P means value is measured in 
pixels.  */)
 DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
        2, 3, 0,
        doc: /* Set amount by which WINDOW should be scrolled vertically to 
VSCROLL.
+This takes effect when redisplaying tall lines or images.
+
 WINDOW nil means use the selected window.  Normally, VSCROLL is a
 non-negative multiple of the canonical character height of WINDOW;
 optional third arg PIXELS-P non-nil means that VSCROLL is in pixels.



-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]