unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Le Wang <l26wang@gmail.com>
Cc: 12401@debbugs.gnu.org
Subject: bug#12401: scroll-preserve-screen-position broken with font height faces
Date: Mon, 10 Sep 2012 21:02:04 +0300	[thread overview]
Message-ID: <83bohdlpsz.fsf@gnu.org> (raw)
In-Reply-To: <CAM=K+ioEoP3+cz2N_pV3K+82jKpjcPmS5y+mDii0GFS6sBLN5w@mail.gmail.com>

> Date: Mon, 10 Sep 2012 20:37:06 +0800
> From: Le Wang <l26wang@gmail.com>
> Cc: 12401@debbugs.gnu.org
> 
> Thanks for the quick response, Eli.
> 
> On Mon, Sep 10, 2012 at 3:23 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 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?
> 
> I understand the problem.
> 
> > 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?
> 
> The contract should be C-v followed by M-v should bring the point back
> to the same line.

Then that feature is not currently available in Emacs scrolling,
sorry.  scroll-preserve-screen-position simply puts the point at or
near the same screen position after the window is scrolled.  That is
all it does.  The manual says that this returns to the previous point
when you scroll back, but that promise has no basis.  When some faces
are higher than the default font, the way Emacs scrolls windows cannot
make sure you will return to the same place.  It can only work when
all the faces use fonts that are no higher than the default face.

> >> 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.
> 
> Sorry about this.  It seems the version I use comes from XEmacs and
> I've made a small fix.  I've placed it here:
> 
> https://gist.github.com/3690403

This package uses an entirely different method of scrolling, one that
is based on lines, not pixels.  I wonder how well it works when
(large) images, display strings, invisible text, and other calamities
are present in the buffer.  In any case, using such a method would
mean a thorough rewrite of window-scrolling primitives.  Volunteers
welcome.





  reply	other threads:[~2012-09-10 18:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10  6:12 bug#12401: scroll-preserve-screen-position broken with font height faces Le Wang
2012-09-10  7:23 ` Eli Zaretskii
2012-09-10 12:37   ` Le Wang
2012-09-10 18:02     ` Eli Zaretskii [this message]
2012-09-10 13:26   ` Stefan Monnier
2012-09-10 18:05     ` Eli Zaretskii
2012-09-10 20:42       ` Stefan Monnier
2012-09-12  8:08       ` martin rudalics
2012-09-12 16:48         ` Eli Zaretskii
2012-09-12 17:38           ` martin rudalics
2022-02-09  9:17 ` Lars Ingebrigtsen
2022-03-09 16:22   ` Lars Ingebrigtsen

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=83bohdlpsz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=12401@debbugs.gnu.org \
    --cc=l26wang@gmail.com \
    /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).