[Top][All Lists]

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

Re: scroll-down with pixel transition

From: Eli Zaretskii
Subject: Re: scroll-down with pixel transition
Date: Thu, 13 Apr 2017 13:24:47 +0300

> From: Tak Kunihiro <address@hidden>
> Date: Thu, 13 Apr 2017 18:22:37 +0900
> Cc: address@hidden, Kunihiro Tak <address@hidden>,
>       address@hidden
> I should have eliminated codes in regard to `pixel-resolution-fine-p’.
> My intension was, to show an example of scrolling single line up with
> (setq pixel-resolution-fine-p nil).

For scrolling in the other direction, the following snippet should I
hope show how to avoid the unwanted extra scroll:

  (defun pscroll-down (arg)
    (interactive "p")
    (let ((pos
             (goto-char (window-start))
             (beginning-of-visual-line 0))))
      (set-window-start nil pos t)
      (set-window-vscroll nil arg t)))
  (define-key global-map [f9] 'pscroll-up)

With this, you can say "C-u 6 F9" and have the window text scrolled
down so that the first 6 pixels of the first screen line are not
shown.  Since this is just a demo, there are no protection against
hitting the beginning of buffer, against point being in the last
screen line, etc.; but adding that should be trivial.

The important part here is that you must call set-window-start as
shown, to force the display engine use that particular position as the
window-start point.  Otherwise, redisplay will reset the window's


reply via email to

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