Subject: bug#12401: scroll-preserve-screen-position broken with font height faces

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Sep 2012 10:23:57 +0300

> Date: Mon, 10 Sep 2012 14:12:39 +0800
> From: Le Wang <[email-masked]>
> 
> with "scroll-preserve-screen-position" set to t, pressing <C-v>, <M-v>
> brings point back to the same buffer position.
> 
> However if I customize a face e.g. font-lock-keyword-face with height
> of 1.3, then this no longer works.  Browsing any emacs-lisp source,
> <C-v>, <M-v> changes line position.

scroll-preserve-screen-position tries to preserve the
_screen_position_ of point, i.e. where you find the cursor, after it
executes one of the scrolling commands.  But since arbitrary pixel
coordinates on the screen might in general (in the presence of
variable-size fonts) correspond to one of 2 possible text lines, Emacs
needs to choose where to put the cursor.  What exactly do you expect
Emacs to do in such a situation, where it simply _cannot_ keep the
same pixel coordinates?

IOW, what is the "contract" that you expect Emacs to keep under
scroll-preserve-screen-position?  Is it just that doing N C-v's
followed by N M-v's brings point to the same location where it was
before this sequence of 2N commands?  Or do you also expect something
from each individual C-v/M-v, and if so, what exactly?

> For reference this package works just fine with variable height faces:
> http://www.cs.utah.edu/~eeide/emacs/scroll-in-place.el.gz

I cannot use it, neither in Emacs 24.2 nor in the current trunk code:
it complains about a missing function screen-width.  Please provide a
complete recipe for using this package, starting with "emacs -Q", in
Emacs 24.2 or newer, so I could study what it does and how.

For that matter, please also provide all the details collected by
report-emacs-bug, they might be important.

Thanks.