From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 32863@debbugs.gnu.org
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 [thread overview]
Message-ID: <20181015114803.GB5623@ACM> (raw)
In-Reply-To: <837ej5710d.fsf@gnu.org>
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).
next prev parent reply other threads:[~2018-10-15 11:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-28 15:28 bug#32863: Unsatisfactory "definition" of "vertical scroll position" in Emacs lisp manual and doc string of window-vscroll Alan Mackenzie
2018-09-28 21:41 ` Eli Zaretskii
2018-10-15 11:48 ` Alan Mackenzie [this message]
2018-10-15 15:32 ` Eli Zaretskii
2018-10-15 18:33 ` Alan Mackenzie
2018-10-15 18:47 ` Eli Zaretskii
2018-10-15 19:13 ` Alan Mackenzie
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181015114803.GB5623@ACM \
--to=acm@muc.de \
--cc=32863@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).